diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 2e63a78efb0f..ddcab0ece5bd 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -511,6 +511,7 @@ com.azure.resourcemanager:azure-resourcemanager-azurestackhci-vm;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-workloadorchestration;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-disconnectedoperations;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-compute-recommender;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-virtualenclaves;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.2;2.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 05e3cac5cadb..33437c356545 100644 --- a/pom.xml +++ b/pom.xml @@ -266,6 +266,7 @@ sdk/trafficmanager sdk/translation sdk/trustedsigning + sdk/virtualenclaves sdk/vision sdk/vmwarecloudsimple sdk/voiceservices diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/CHANGELOG.md b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/CHANGELOG.md new file mode 100644 index 000000000000..34a16a9eeaaf --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-10-16) + +- Azure Resource Manager Virtual Enclaves client library for Java. This package contains Microsoft Azure SDK for Virtual Enclaves Management SDK. Microsoft Mission Resource Provider management API. Package api-version 2025-05-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-virtualenclaves Java SDK. diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/README.md b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/README.md new file mode 100644 index 000000000000..5d038b87fb23 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Virtual Enclaves client library for Java + +Azure Resource Manager Virtual Enclaves client library for Java. + +This package contains Microsoft Azure SDK for Virtual Enclaves Management SDK. Microsoft Mission Resource Provider management API. Package api-version 2025-05-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-virtualenclaves;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-virtualenclaves + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +VirtualEnclavesManager manager = VirtualEnclavesManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/SAMPLE.md b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/SAMPLE.md new file mode 100644 index 000000000000..10ab8f85db2f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/SAMPLE.md @@ -0,0 +1,2159 @@ +# Code snippets and samples + + +## Approval + +- [CreateOrUpdate](#approval_createorupdate) +- [Delete](#approval_delete) +- [Get](#approval_get) +- [ListByParent](#approval_listbyparent) +- [NotifyInitiator](#approval_notifyinitiator) +- [Update](#approval_update) + +## Community + +- [CheckAddressSpaceAvailability](#community_checkaddressspaceavailability) +- [CreateOrUpdate](#community_createorupdate) +- [Delete](#community_delete) +- [GetByResourceGroup](#community_getbyresourcegroup) +- [List](#community_list) +- [ListByResourceGroup](#community_listbyresourcegroup) +- [Update](#community_update) + +## CommunityEndpoints + +- [CreateOrUpdate](#communityendpoints_createorupdate) +- [Delete](#communityendpoints_delete) +- [Get](#communityendpoints_get) +- [HandleApprovalCreation](#communityendpoints_handleapprovalcreation) +- [HandleApprovalDeletion](#communityendpoints_handleapprovaldeletion) +- [ListByCommunityResource](#communityendpoints_listbycommunityresource) +- [ListBySubscription](#communityendpoints_listbysubscription) +- [Update](#communityendpoints_update) + +## EnclaveConnection + +- [CreateOrUpdate](#enclaveconnection_createorupdate) +- [Delete](#enclaveconnection_delete) +- [GetByResourceGroup](#enclaveconnection_getbyresourcegroup) +- [HandleApprovalCreation](#enclaveconnection_handleapprovalcreation) +- [HandleApprovalDeletion](#enclaveconnection_handleapprovaldeletion) +- [List](#enclaveconnection_list) +- [ListByResourceGroup](#enclaveconnection_listbyresourcegroup) +- [Update](#enclaveconnection_update) + +## EnclaveEndpoints + +- [CreateOrUpdate](#enclaveendpoints_createorupdate) +- [Delete](#enclaveendpoints_delete) +- [Get](#enclaveendpoints_get) +- [HandleApprovalCreation](#enclaveendpoints_handleapprovalcreation) +- [HandleApprovalDeletion](#enclaveendpoints_handleapprovaldeletion) +- [ListByEnclaveResource](#enclaveendpoints_listbyenclaveresource) +- [ListBySubscription](#enclaveendpoints_listbysubscription) +- [Update](#enclaveendpoints_update) + +## Operations + +- [List](#operations_list) + +## TransitHub + +- [CreateOrUpdate](#transithub_createorupdate) +- [Delete](#transithub_delete) +- [Get](#transithub_get) +- [ListByCommunityResource](#transithub_listbycommunityresource) +- [ListBySubscription](#transithub_listbysubscription) +- [Update](#transithub_update) + +## VirtualEnclave + +- [CreateOrUpdate](#virtualenclave_createorupdate) +- [Delete](#virtualenclave_delete) +- [GetByResourceGroup](#virtualenclave_getbyresourcegroup) +- [HandleApprovalCreation](#virtualenclave_handleapprovalcreation) +- [HandleApprovalDeletion](#virtualenclave_handleapprovaldeletion) +- [List](#virtualenclave_list) +- [ListByResourceGroup](#virtualenclave_listbyresourcegroup) +- [Update](#virtualenclave_update) + +## Workload + +- [CreateOrUpdate](#workload_createorupdate) +- [Delete](#workload_delete) +- [Get](#workload_get) +- [ListByEnclaveResource](#workload_listbyenclaveresource) +- [ListBySubscription](#workload_listbysubscription) +- [Update](#workload_update) +### Approval_CreateOrUpdate + +```java +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalProperties; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.Approver; +import com.azure.resourcemanager.virtualenclaves.models.RequestMetadata; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Approval CreateOrUpdate. + */ +public final class ApprovalCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_CreateOrUpdate.json + */ + /** + * Sample code: Approval_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + approvalCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.approvals() + .define("TestApprovals") + .withExistingResourceUri( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection") + .withProperties(new ApprovalProperties().withParentResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/virtualenclaves/TestMyEnclave") + .withGrandparentResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity") + .withApprovers(Arrays.asList(new Approver().withApproverEntraId("00000000-0000-0000-0000-000000000000") + .withActionPerformed(ActionPerformed.APPROVED) + .withLastUpdatedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")))) + .withTicketId("string") + .withCreatedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")) + .withStateChangedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")) + .withRequestMetadata(new RequestMetadata().withResourceAction("string") + .withApprovalCallbackRoute("approvalCallback") + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}") + .withApprovalStatus(ApprovalStatus.APPROVED))) + .create(); + } +} +``` + +### Approval_Delete + +```java +/** + * Samples for Approval Delete. + */ +public final class ApprovalDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_Delete.json + */ + /** + * Sample code: Approval_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void approvalDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.approvals() + .delete( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + "TestApprovals", com.azure.core.util.Context.NONE); + } +} +``` + +### Approval_Get + +```java +/** + * Samples for Approval Get. + */ +public final class ApprovalGetSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_Get.json + */ + /** + * Sample code: Approval_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void approvalGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.approvals() + .getWithResponse( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + "TestApprovals", com.azure.core.util.Context.NONE); + } +} +``` + +### Approval_ListByParent + +```java +/** + * Samples for Approval ListByParent. + */ +public final class ApprovalListByParentSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_ListByParent.json + */ + /** + * Sample code: Approval_ListByParent. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void approvalListByParent(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.approvals() + .listByParent( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + com.azure.core.util.Context.NONE); + } +} +``` + +### Approval_NotifyInitiator + +```java +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequestApprovalStatus; + +/** + * Samples for Approval NotifyInitiator. + */ +public final class ApprovalNotifyInitiatorSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_NotifyInitiator.json + */ + /** + * Sample code: Approval_NotifyInitiator. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + approvalNotifyInitiator(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.approvals() + .notifyInitiator( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + "TestApprovals", + new ApprovalActionRequest().withApprovalStatus(ApprovalActionRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} +``` + +### Approval_Update + +```java +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalResource; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.Approver; +import com.azure.resourcemanager.virtualenclaves.models.RequestMetadataUpdatableProperties; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Approval Update. + */ +public final class ApprovalUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_Update.json + */ + /** + * Sample code: Approval_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void approvalUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + ApprovalResource resource = manager.approvals() + .getWithResponse( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + "TestApprovals", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new ApprovalPatchProperties().withParentResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/virtualenclaves/TestMyEnclave") + .withGrandparentResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity") + .withApprovers(Arrays.asList(new Approver().withApproverEntraId("00000000-0000-0000-0000-000000000000") + .withActionPerformed(ActionPerformed.APPROVED) + .withLastUpdatedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")))) + .withTicketId("string") + .withCreatedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")) + .withStateChangedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")) + .withRequestMetadata(new RequestMetadataUpdatableProperties().withResourceAction("string") + .withApprovalCallbackRoute("approvalCallback") + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}") + .withApprovalStatus(ApprovalStatus.APPROVED))) + .apply(); + } +} +``` + +### Community_CheckAddressSpaceAvailability + +```java +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import java.util.Arrays; + +/** + * Samples for Community CheckAddressSpaceAvailability. + */ +public final class CommunityCheckAddressSpaceAvailabilitySamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_PostCheckAddressSpaceAvailability.json + */ + /** + * Sample code: Community_CheckAddressSpaceAvailability. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityCheckAddressSpaceAvailability( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities() + .checkAddressSpaceAvailabilityWithResponse("rgopenapi", "TestMyCommunity", + new CheckAddressSpaceAvailabilityRequest().withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/communities/TestMyCommunity") + .withEnclaveVirtualNetwork(new EnclaveVirtualNetworkModel().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withSubnetName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true)), + com.azure.core.util.Context.NONE); + } +} +``` + +### Community_CreateOrUpdate + +```java +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalSettings; +import com.azure.resourcemanager.virtualenclaves.models.CommunityProperties; +import com.azure.resourcemanager.virtualenclaves.models.FirewallSKU; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Community CreateOrUpdate. + */ +public final class CommunityCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_CreateOrUpdate.json + */ + /** + * Sample code: Community_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities() + .define("TestMyCommunity") + .withRegion("westcentralus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new CommunityProperties().withAddressSpace("10.0.0.0/24") + .withDnsServers(Arrays.asList("azure.net")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withServiceId(ServiceIdentifier.AKS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.APP_SERVICE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.CONTAINER_REGISTRY) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.KEY_VAULT) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.MICROSOFT_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.MONITORING) + .withOption(GovernedServiceItemOption.fromString("Not Applicable")) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.POSTGRE_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.SERVICE_BUS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.STORAGE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.AZURE_FIREWALLS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.INSIGHTS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.LOGIC) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.DATA_CONNECTORS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE))) + .withCommunityRoleAssignments(Arrays.asList(new RoleAssignmentItem() + .withRoleDefinitionId("b24988ac-6180-42a0-ab88-20f7382dd24c") + .withPrincipals(Arrays.asList( + new Principal().withId("01234567-89ab-ef01-2345-0123456789ab").withType(PrincipalType.GROUP), + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c0").withType(PrincipalType.USER))), + new RoleAssignmentItem().withRoleDefinitionId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER))))) + .withFirewallSku(FirewallSKU.STANDARD) + .withApprovalSettings(new ApprovalSettings().withEndpointCreation(ApprovalPolicy.NOT_REQUIRED) + .withEndpointUpdate(ApprovalPolicy.REQUIRED) + .withEndpointDeletion(ApprovalPolicy.NOT_REQUIRED) + .withConnectionCreation(ApprovalPolicy.REQUIRED) + .withConnectionUpdate(ApprovalPolicy.REQUIRED) + .withConnectionDeletion(ApprovalPolicy.NOT_REQUIRED) + .withEnclaveCreation(ApprovalPolicy.NOT_REQUIRED) + .withEnclaveDeletion(ApprovalPolicy.NOT_REQUIRED) + .withMaintenanceMode(ApprovalPolicy.NOT_REQUIRED) + .withServiceCatalogDeployment(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalCreation(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalAction(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalDeletion(ApprovalPolicy.NOT_REQUIRED) + .withMandatoryApprovers(Arrays + .asList(new MandatoryApprover().withApproverEntraId("00000000-0000-0000-0000-000000000000"))) + .withMinimumApproversRequired(0L)) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationModel() + .withMode(MaintenanceModeConfigurationModelMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationModelJustification.OFF))) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Community_Delete + +```java +/** + * Samples for Community Delete. + */ +public final class CommunityDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_Delete.json + */ + /** + * Sample code: Community_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities().delete("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} +``` + +### Community_GetByResourceGroup + +```java +/** + * Samples for Community GetByResourceGroup. + */ +public final class CommunityGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_Get.json + */ + /** + * Sample code: Community_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities() + .getByResourceGroupWithResponse("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} +``` + +### Community_List + +```java +/** + * Samples for Community List. + */ +public final class CommunityListSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_ListBySubscription.json + */ + /** + * Sample code: Community_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Community_ListByResourceGroup + +```java +/** + * Samples for Community ListByResourceGroup. + */ +public final class CommunityListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_ListByResourceGroup.json + */ + /** + * Sample code: Community_ListByResourceGroup. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityListByResourceGroup(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} +``` + +### Community_Update + +```java +import com.azure.resourcemanager.virtualenclaves.models.CommunityPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityResource; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Community Update. + */ +public final class CommunityUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_Update.json + */ + /** + * Sample code: Community_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + CommunityResource resource = manager.communities() + .getByResourceGroupWithResponse("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new CommunityPatchProperties().withDnsServers(Arrays.asList("azure.net")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withServiceId(ServiceIdentifier.AKS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.APP_SERVICE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.CONTAINER_REGISTRY) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.KEY_VAULT) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.MICROSOFT_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.MONITORING) + .withOption(GovernedServiceItemOption.fromString("Not Applicable")) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.POSTGRE_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.SERVICE_BUS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.STORAGE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.AZURE_FIREWALLS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.INSIGHTS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.LOGIC) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.DATA_CONNECTORS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE))) + .withCommunityRoleAssignments(Arrays.asList(new RoleAssignmentItem() + .withRoleDefinitionId("b24988ac-6180-42a0-ab88-20f7382dd24c") + .withPrincipals(Arrays.asList( + new Principal().withId("01234567-89ab-ef01-2345-0123456789ab").withType(PrincipalType.GROUP), + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c0").withType(PrincipalType.USER))), + new RoleAssignmentItem().withRoleDefinitionId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER)))))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### CommunityEndpoints_CreateOrUpdate + +```java +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CommunityEndpoints CreateOrUpdate. + */ +public final class CommunityEndpointsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_CreateOrUpdate.json + */ + /** + * Sample code: CommunityEndpoints_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityEndpointsCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .define("TestMyCommunityEndpoint") + .withRegion("West US") + .withExistingCommunity("rgopenapi", "TestMyCommunity") + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new CommunityEndpointProperties().withRuleCollection( + Arrays.asList(new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDNTAG) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.TCP)) + .withTransitHubResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity/transitHubs/TestThName") + .withDestination("foo.example.com") + .withPorts("443")))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### CommunityEndpoints_Delete + +```java +/** + * Samples for CommunityEndpoints Delete. + */ +public final class CommunityEndpointsDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_Delete.json + */ + /** + * Sample code: CommunityEndpoints_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityEndpointsDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .delete("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityEndpoints_Get + +```java +/** + * Samples for CommunityEndpoints Get. + */ +public final class CommunityEndpointsGetSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_Get.json + */ + /** + * Sample code: CommunityEndpoints_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityEndpointsGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityEndpoints_HandleApprovalCreation + +```java +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for CommunityEndpoints HandleApprovalCreation. + */ +public final class CommunityEndpointsHandleApprovalCreationSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_HandleApprovalCreation.json + */ + /** + * Sample code: CommunityEndpoints_HandleApprovalCreation. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityEndpointsHandleApprovalCreation( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .handleApprovalCreation("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityEndpoints_HandleApprovalDeletion + +```java +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for CommunityEndpoints HandleApprovalDeletion. + */ +public final class CommunityEndpointsHandleApprovalDeletionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_HandleApprovalDeletion.json + */ + /** + * Sample code: CommunityEndpoints_HandleApprovalDeletion. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityEndpointsHandleApprovalDeletion( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .handleApprovalDeletion( + "rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityEndpoints_ListByCommunityResource + +```java +/** + * Samples for CommunityEndpoints ListByCommunityResource. + */ +public final class CommunityEndpointsListByCommunityResourceSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_ListByCommunityResource.json + */ + /** + * Sample code: CommunityEndpoints_ListByCommunityResource. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityEndpointsListByCommunityResource( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .listByCommunityResource("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityEndpoints_ListBySubscription + +```java +/** + * Samples for CommunityEndpoints ListBySubscription. + */ +public final class CommunityEndpointsListBySubscriptionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_ListBySubscription.json + */ + /** + * Sample code: CommunityEndpoints_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityEndpointsListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints().listBySubscription("TestMyCommunity", com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityEndpoints_Update + +```java +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointResource; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CommunityEndpoints Update. + */ +public final class CommunityEndpointsUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_Update.json + */ + /** + * Sample code: CommunityEndpoints_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityEndpointsUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + CommunityEndpointResource resource = manager.communityEndpoints() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new CommunityEndpointPatchProperties().withRuleCollection( + Arrays.asList(new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDN) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.TCP)) + .withTransitHubResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity/transitHubs/TestThName") + .withDestination("foo.example.com") + .withPorts("443")))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### EnclaveConnection_CreateOrUpdate + +```java +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveConnection CreateOrUpdate. + */ +public final class EnclaveConnectionCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_CreateOrUpdate.json + */ + /** + * Sample code: EnclaveConnection_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveConnectionCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections() + .define("TestMyEnclaveConnection") + .withRegion("West US") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new EnclaveConnectionProperties().withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity") + .withSourceResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/virtualenclaves/TestMyEnclave") + .withSourceCidr("10.0.0.0/24") + .withDestinationEndpointId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/virtualenclaves/TestMyEnclave/enclaveendpoints/TestMyEnclaveEndpoint")) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### EnclaveConnection_Delete + +```java +/** + * Samples for EnclaveConnection Delete. + */ +public final class EnclaveConnectionDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_Delete.json + */ + /** + * Sample code: EnclaveConnection_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveConnectionDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections().delete("rgopenapi", "TestMyEnclaveConnection", com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveConnection_GetByResourceGroup + +```java +/** + * Samples for EnclaveConnection GetByResourceGroup. + */ +public final class EnclaveConnectionGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_Get.json + */ + /** + * Sample code: EnclaveConnection_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveConnectionGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclaveConnection", com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveConnection_HandleApprovalCreation + +```java +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveConnection HandleApprovalCreation. + */ +public final class EnclaveConnectionHandleApprovalCreationSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_HandleApprovalCreation.json + */ + /** + * Sample code: EnclaveConnection_HandleApprovalCreation. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveConnectionHandleApprovalCreation( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections() + .handleApprovalCreation("rgopenapi", "TestMyEnclaveConnection", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED) + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}"), + com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveConnection_HandleApprovalDeletion + +```java +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveConnection HandleApprovalDeletion. + */ +public final class EnclaveConnectionHandleApprovalDeletionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_HandleApprovalDeletion.json + */ + /** + * Sample code: EnclaveConnection_HandleApprovalDeletion. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveConnectionHandleApprovalDeletion( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections() + .handleApprovalDeletion("rgopenapi", "TestMyEnclaveConnection", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveConnection_List + +```java +/** + * Samples for EnclaveConnection List. + */ +public final class EnclaveConnectionListSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_ListBySubscription.json + */ + /** + * Sample code: EnclaveConnection_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveConnectionListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections().list(com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveConnection_ListByResourceGroup + +```java +/** + * Samples for EnclaveConnection ListByResourceGroup. + */ +public final class EnclaveConnectionListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_ListByResourceGroup.json + */ + /** + * Sample code: EnclaveConnection_ListByResourceGroup. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveConnectionListByResourceGroup(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveConnection_Update + +```java +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveConnection Update. + */ +public final class EnclaveConnectionUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_Update.json + */ + /** + * Sample code: EnclaveConnection_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveConnectionUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + EnclaveConnectionResource resource = manager.enclaveConnections() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclaveConnection", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new EnclaveConnectionPatchProperties().withSourceCidr("10.0.0.0/24")) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### EnclaveEndpoints_CreateOrUpdate + +```java +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveEndpoints CreateOrUpdate. + */ +public final class EnclaveEndpointsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_CreateOrUpdate.json + */ + /** + * Sample code: EnclaveEndpoints_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveEndpointsCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .define("TestMyEnclaveEndpoint") + .withRegion("West US") + .withExistingVirtualEnclave("rgopenapi", "TestMyEnclave") + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new EnclaveEndpointProperties().withRuleCollection(Arrays + .asList(new EnclaveEndpointDestinationRule().withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP)) + .withEndpointRuleName("54CEECEF-2C30-488E-946F-D20F414D99BA") + .withDestination("10.0.0.0/24") + .withPorts("443")))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### EnclaveEndpoints_Delete + +```java +/** + * Samples for EnclaveEndpoints Delete. + */ +public final class EnclaveEndpointsDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_Delete.json + */ + /** + * Sample code: EnclaveEndpoints_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveEndpointsDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .delete("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveEndpoints_Get + +```java +/** + * Samples for EnclaveEndpoints Get. + */ +public final class EnclaveEndpointsGetSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_Get.json + */ + /** + * Sample code: EnclaveEndpoints_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveEndpointsGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveEndpoints_HandleApprovalCreation + +```java +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveEndpoints HandleApprovalCreation. + */ +public final class EnclaveEndpointsHandleApprovalCreationSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_HandleApprovalCreation.json + */ + /** + * Sample code: EnclaveEndpoints_HandleApprovalCreation. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveEndpointsHandleApprovalCreation( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .handleApprovalCreation("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveEndpoints_HandleApprovalDeletion + +```java +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveEndpoints HandleApprovalDeletion. + */ +public final class EnclaveEndpointsHandleApprovalDeletionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_HandleApprovalDeletion.json + */ + /** + * Sample code: EnclaveEndpoints_HandleApprovalDeletion. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveEndpointsHandleApprovalDeletion( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .handleApprovalDeletion( + "rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveEndpoints_ListByEnclaveResource + +```java +/** + * Samples for EnclaveEndpoints ListByEnclaveResource. + */ +public final class EnclaveEndpointsListByEnclaveResourceSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_ListByEnclaveResource.json + */ + /** + * Sample code: EnclaveEndpoints_ListByEnclaveResource. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveEndpointsListByEnclaveResource( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .listByEnclaveResource("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveEndpoints_ListBySubscription + +```java +/** + * Samples for EnclaveEndpoints ListBySubscription. + */ +public final class EnclaveEndpointsListBySubscriptionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_ListBySubscription.json + */ + /** + * Sample code: EnclaveEndpoints_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveEndpointsListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints().listBySubscription("TestMyEnclave", com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveEndpoints_Update + +```java +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointResource; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveEndpoints Update. + */ +public final class EnclaveEndpointsUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_Update.json + */ + /** + * Sample code: EnclaveEndpoints_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveEndpointsUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + EnclaveEndpointResource resource = manager.enclaveEndpoints() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new EnclaveEndpointPatchProperties().withRuleCollection(Arrays + .asList(new EnclaveEndpointDestinationRule().withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP)) + .withEndpointRuleName("54CEECEF-2C30-488E-946F-D20F414D99BA") + .withDestination("10.0.0.0/24") + .withPorts("443")))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void operationsList(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### TransitHub_CreateOrUpdate + +```java +import com.azure.resourcemanager.virtualenclaves.models.TransitHubProperties; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOption; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for TransitHub CreateOrUpdate. + */ +public final class TransitHubCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_CreateOrUpdate.json + */ + /** + * Sample code: TransitHub_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + transitHubCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.transitHubs() + .define("TestThName") + .withRegion("westcentralus") + .withExistingCommunity("rgopenapi", "TestMyCommunity") + .withTags(mapOf("Tag1", "Value1")) + .withProperties(new TransitHubProperties().withState(TransitHubState.PENDING_APPROVAL) + .withTransitOption(new TransitOption().withType(TransitOptionType.EXPRESS_ROUTE) + .withParams(new TransitOptionParams().withScaleUnits(1L)))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### TransitHub_Delete + +```java +/** + * Samples for TransitHub Delete. + */ +public final class TransitHubDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_Delete.json + */ + /** + * Sample code: TransitHub_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void transitHubDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.transitHubs().delete("rgopenapi", "TestMyCommunity", "TestThName", com.azure.core.util.Context.NONE); + } +} +``` + +### TransitHub_Get + +```java +/** + * Samples for TransitHub Get. + */ +public final class TransitHubGetSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_Get.json + */ + /** + * Sample code: TransitHub_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void transitHubGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.transitHubs() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestThName", com.azure.core.util.Context.NONE); + } +} +``` + +### TransitHub_ListByCommunityResource + +```java +/** + * Samples for TransitHub ListByCommunityResource. + */ +public final class TransitHubListByCommunityResourceSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_ListByCommunityResource.json + */ + /** + * Sample code: TransitHub_ListByCommunityResource. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + transitHubListByCommunityResource(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.transitHubs().listByCommunityResource("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} +``` + +### TransitHub_ListBySubscription + +```java +/** + * Samples for TransitHub ListBySubscription. + */ +public final class TransitHubListBySubscriptionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_ListBySubscription.json + */ + /** + * Sample code: TransitHub_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + transitHubListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.transitHubs().listBySubscription("TestMyCommunity", com.azure.core.util.Context.NONE); + } +} +``` + +### TransitHub_Update + +```java +import com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubResource; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOption; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for TransitHub Update. + */ +public final class TransitHubUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_Update.json + */ + /** + * Sample code: TransitHub_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void transitHubUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + TransitHubResource resource = manager.transitHubs() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestThName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key4278", "fakeTokenPlaceholder")) + .withProperties(new TransitHubPatchProperties().withState(TransitHubState.PENDING_APPROVAL) + .withTransitOption(new TransitOption().withType(TransitOptionType.EXPRESS_ROUTE) + .withParams(new TransitOptionParams().withScaleUnits(1L)))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### VirtualEnclave_CreateOrUpdate + +```java +import com.azure.resourcemanager.virtualenclaves.models.DiagnosticDestination; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveDefaultSettingsModel; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclaveProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for VirtualEnclave CreateOrUpdate. + */ +public final class VirtualEnclaveCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_CreateOrUpdate.json + */ + /** + * Sample code: VirtualEnclave_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + virtualEnclaveCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves() + .define("TestMyEnclave") + .withRegion("westcentralus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("Tag1", "Value1")) + .withProperties(new VirtualEnclaveProperties() + .withEnclaveVirtualNetwork(new EnclaveVirtualNetworkModel().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withSubnetName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true)) + .withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/communities/TestMyCommunity") + .withBastionEnabled(true) + .withEnclaveRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("b24988ac-6180-42a0-ab88-20f7382dd24c") + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER), + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c0") + .withType(PrincipalType.USER))), + new RoleAssignmentItem().withRoleDefinitionId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER))))) + .withWorkloadRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("d73bb868-a0df-4d4d-bd69-98a00b01fccb") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))), + new RoleAssignmentItem().withRoleDefinitionId("fb879df8-f326-4884-b1cf-06f3ad86be52") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))))) + .withEnclaveDefaultSettings( + new EnclaveDefaultSettingsModel().withDiagnosticDestination(DiagnosticDestination.BOTH)) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationModel() + .withMode(MaintenanceModeConfigurationModelMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationModelJustification.OFF))) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### VirtualEnclave_Delete + +```java +/** + * Samples for VirtualEnclave Delete. + */ +public final class VirtualEnclaveDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_Delete.json + */ + /** + * Sample code: VirtualEnclave_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void virtualEnclaveDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves().delete("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualEnclave_GetByResourceGroup + +```java +/** + * Samples for VirtualEnclave GetByResourceGroup. + */ +public final class VirtualEnclaveGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_Get.json + */ + /** + * Sample code: VirtualEnclave_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void virtualEnclaveGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualEnclave_HandleApprovalCreation + +```java +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for VirtualEnclave HandleApprovalCreation. + */ +public final class VirtualEnclaveHandleApprovalCreationSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_HandleApprovalCreation.json + */ + /** + * Sample code: VirtualEnclave_HandleApprovalCreation. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + virtualEnclaveHandleApprovalCreation(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves() + .handleApprovalCreation("rgopenapi", "TestMyEnclave", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED) + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}"), + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualEnclave_HandleApprovalDeletion + +```java +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for VirtualEnclave HandleApprovalDeletion. + */ +public final class VirtualEnclaveHandleApprovalDeletionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_HandleApprovalDeletion.json + */ + /** + * Sample code: VirtualEnclave_HandleApprovalDeletion. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + virtualEnclaveHandleApprovalDeletion(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves() + .handleApprovalDeletion("rgopenapi", "TestMyEnclave", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualEnclave_List + +```java +/** + * Samples for VirtualEnclave List. + */ +public final class VirtualEnclaveListSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_ListBySubscription.json + */ + /** + * Sample code: VirtualEnclave_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + virtualEnclaveListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves().list(com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualEnclave_ListByResourceGroup + +```java +/** + * Samples for VirtualEnclave ListByResourceGroup. + */ +public final class VirtualEnclaveListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_ListByResourceGroup.json + */ + /** + * Sample code: VirtualEnclave_ListByResourceGroup. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + virtualEnclaveListByResourceGroup(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualEnclave_Update + +```java +import com.azure.resourcemanager.virtualenclaves.models.DiagnosticDestination; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveDefaultSettingsPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveResource; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for VirtualEnclave Update. + */ +public final class VirtualEnclaveUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_Update.json + */ + /** + * Sample code: VirtualEnclave_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void virtualEnclaveUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + EnclaveResource resource = manager.virtualEnclaves() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("Tag1", "Value1")) + .withProperties(new VirtualEnclavePatchProperties() + .withEnclaveVirtualNetwork(new EnclaveVirtualNetworkModel().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withSubnetName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true)) + .withBastionEnabled(true) + .withEnclaveRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("b24988ac-6180-42a0-ab88-20f7382dd24c") + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER), + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c0") + .withType(PrincipalType.USER))), + new RoleAssignmentItem().withRoleDefinitionId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER))))) + .withWorkloadRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("d73bb868-a0df-4d4d-bd69-98a00b01fccb") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))), + new RoleAssignmentItem().withRoleDefinitionId("fb879df8-f326-4884-b1cf-06f3ad86be52") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))))) + .withEnclaveDefaultSettings( + new EnclaveDefaultSettingsPatchModel().withDiagnosticDestination(DiagnosticDestination.BOTH)) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationPatchModel() + .withMode(MaintenanceModeConfigurationModelMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationModelJustification.OFF))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Workload_CreateOrUpdate + +```java +import com.azure.resourcemanager.virtualenclaves.models.WorkloadProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Workload CreateOrUpdate. + */ +public final class WorkloadCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_CreateOrUpdate.json + */ + /** + * Sample code: Workload_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + workloadCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.workloads() + .define("TestMyWorkload") + .withRegion("westcentralus") + .withExistingVirtualEnclave("rgopenapi", "TestMyEnclave") + .withTags(mapOf("TestKey", "fakeTokenPlaceholder")) + .withProperties(new WorkloadProperties().withResourceGroupCollection(Arrays.asList())) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Workload_Delete + +```java +/** + * Samples for Workload Delete. + */ +public final class WorkloadDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_Delete.json + */ + /** + * Sample code: Workload_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void workloadDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.workloads().delete("rgopenapi", "TestMyEnclave", "TestMyWorkload", com.azure.core.util.Context.NONE); + } +} +``` + +### Workload_Get + +```java +/** + * Samples for Workload Get. + */ +public final class WorkloadGetSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_Get.json + */ + /** + * Sample code: Workload_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void workloadGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.workloads() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyWorkload", com.azure.core.util.Context.NONE); + } +} +``` + +### Workload_ListByEnclaveResource + +```java +/** + * Samples for Workload ListByEnclaveResource. + */ +public final class WorkloadListByEnclaveResourceSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_ListByEnclaveResource.json + */ + /** + * Sample code: Workload_ListByEnclaveResource. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + workloadListByEnclaveResource(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.workloads().listByEnclaveResource("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} +``` + +### Workload_ListBySubscription + +```java +/** + * Samples for Workload ListBySubscription. + */ +public final class WorkloadListBySubscriptionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_ListBySubscription.json + */ + /** + * Sample code: Workload_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + workloadListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.workloads().listBySubscription("TestMyEnclave", com.azure.core.util.Context.NONE); + } +} +``` + +### Workload_Update + +```java +import com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadResource; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Workload Update. + */ +public final class WorkloadUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_Update.json + */ + /** + * Sample code: Workload_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void workloadUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + WorkloadResource resource = manager.workloads() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyWorkload", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key9465", "fakeTokenPlaceholder")) + .withProperties(new WorkloadPatchProperties().withResourceGroupCollection(Arrays.asList("g"))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/pom.xml b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/pom.xml new file mode 100644 index 000000000000..07c304e14fe6 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-virtualenclaves + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Virtual Enclaves Management + This package contains Microsoft Azure SDK for Virtual Enclaves Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft Mission Resource Provider management API. Package api-version 2025-05-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.57.0 + + + com.azure + azure-core-management + 1.19.2 + + + com.azure + azure-core-test + 1.27.0-beta.13 + test + + + com.azure + azure-identity + 1.18.1 + test + + + diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/VirtualEnclavesManager.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/VirtualEnclavesManager.java new file mode 100644 index 000000000000..7344c4afd059 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/VirtualEnclavesManager.java @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesManagementClient; +import com.azure.resourcemanager.virtualenclaves.implementation.ApprovalsImpl; +import com.azure.resourcemanager.virtualenclaves.implementation.CommunitiesImpl; +import com.azure.resourcemanager.virtualenclaves.implementation.CommunityEndpointsImpl; +import com.azure.resourcemanager.virtualenclaves.implementation.EnclaveConnectionsImpl; +import com.azure.resourcemanager.virtualenclaves.implementation.EnclaveEndpointsImpl; +import com.azure.resourcemanager.virtualenclaves.implementation.OperationsImpl; +import com.azure.resourcemanager.virtualenclaves.implementation.TransitHubsImpl; +import com.azure.resourcemanager.virtualenclaves.implementation.VirtualEnclavesImpl; +import com.azure.resourcemanager.virtualenclaves.implementation.VirtualEnclavesManagementClientBuilder; +import com.azure.resourcemanager.virtualenclaves.implementation.WorkloadsImpl; +import com.azure.resourcemanager.virtualenclaves.models.Approvals; +import com.azure.resourcemanager.virtualenclaves.models.Communities; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpoints; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnections; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpoints; +import com.azure.resourcemanager.virtualenclaves.models.Operations; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubs; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclaves; +import com.azure.resourcemanager.virtualenclaves.models.Workloads; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to VirtualEnclavesManager. + * Microsoft Mission Resource Provider management API. + */ +public final class VirtualEnclavesManager { + private Operations operations; + + private Workloads workloads; + + private VirtualEnclaves virtualEnclaves; + + private Communities communities; + + private TransitHubs transitHubs; + + private EnclaveConnections enclaveConnections; + + private EnclaveEndpoints enclaveEndpoints; + + private CommunityEndpoints communityEndpoints; + + private Approvals approvals; + + private final VirtualEnclavesManagementClient clientObject; + + private VirtualEnclavesManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new VirtualEnclavesManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Virtual Enclaves service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Virtual Enclaves service API instance. + */ + public static VirtualEnclavesManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Virtual Enclaves service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Virtual Enclaves service API instance. + */ + public static VirtualEnclavesManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new VirtualEnclavesManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create VirtualEnclavesManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new VirtualEnclavesManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-virtualenclaves.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Virtual Enclaves service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Virtual Enclaves service API instance. + */ + public VirtualEnclavesManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.virtualenclaves") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new VirtualEnclavesManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Workloads. It manages WorkloadResource. + * + * @return Resource collection API of Workloads. + */ + public Workloads workloads() { + if (this.workloads == null) { + this.workloads = new WorkloadsImpl(clientObject.getWorkloads(), this); + } + return workloads; + } + + /** + * Gets the resource collection API of VirtualEnclaves. It manages EnclaveResource. + * + * @return Resource collection API of VirtualEnclaves. + */ + public VirtualEnclaves virtualEnclaves() { + if (this.virtualEnclaves == null) { + this.virtualEnclaves = new VirtualEnclavesImpl(clientObject.getVirtualEnclaves(), this); + } + return virtualEnclaves; + } + + /** + * Gets the resource collection API of Communities. It manages CommunityResource. + * + * @return Resource collection API of Communities. + */ + public Communities communities() { + if (this.communities == null) { + this.communities = new CommunitiesImpl(clientObject.getCommunities(), this); + } + return communities; + } + + /** + * Gets the resource collection API of TransitHubs. It manages TransitHubResource. + * + * @return Resource collection API of TransitHubs. + */ + public TransitHubs transitHubs() { + if (this.transitHubs == null) { + this.transitHubs = new TransitHubsImpl(clientObject.getTransitHubs(), this); + } + return transitHubs; + } + + /** + * Gets the resource collection API of EnclaveConnections. It manages EnclaveConnectionResource. + * + * @return Resource collection API of EnclaveConnections. + */ + public EnclaveConnections enclaveConnections() { + if (this.enclaveConnections == null) { + this.enclaveConnections = new EnclaveConnectionsImpl(clientObject.getEnclaveConnections(), this); + } + return enclaveConnections; + } + + /** + * Gets the resource collection API of EnclaveEndpoints. It manages EnclaveEndpointResource. + * + * @return Resource collection API of EnclaveEndpoints. + */ + public EnclaveEndpoints enclaveEndpoints() { + if (this.enclaveEndpoints == null) { + this.enclaveEndpoints = new EnclaveEndpointsImpl(clientObject.getEnclaveEndpoints(), this); + } + return enclaveEndpoints; + } + + /** + * Gets the resource collection API of CommunityEndpoints. It manages CommunityEndpointResource. + * + * @return Resource collection API of CommunityEndpoints. + */ + public CommunityEndpoints communityEndpoints() { + if (this.communityEndpoints == null) { + this.communityEndpoints = new CommunityEndpointsImpl(clientObject.getCommunityEndpoints(), this); + } + return communityEndpoints; + } + + /** + * Gets the resource collection API of Approvals. It manages ApprovalResource. + * + * @return Resource collection API of Approvals. + */ + public Approvals approvals() { + if (this.approvals == null) { + this.approvals = new ApprovalsImpl(clientObject.getApprovals(), this); + } + return approvals; + } + + /** + * Gets wrapped service client VirtualEnclavesManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client VirtualEnclavesManagementClient. + */ + public VirtualEnclavesManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/ApprovalsClient.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/ApprovalsClient.java new file mode 100644 index 000000000000..5081ab82e73b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/ApprovalsClient.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchModel; + +/** + * An instance of this class provides access to all the operations defined in ApprovalsClient. + */ +public interface ApprovalsClient { + /** + * Get a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ApprovalResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String approvalName, Context context); + + /** + * Get a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ApprovalResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalResourceInner get(String resourceUri, String approvalName); + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalResourceInner> beginCreateOrUpdate(String resourceUri, + String approvalName, ApprovalResourceInner resource); + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalResourceInner> beginCreateOrUpdate(String resourceUri, + String approvalName, ApprovalResourceInner resource, Context context); + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalResourceInner createOrUpdate(String resourceUri, String approvalName, ApprovalResourceInner resource); + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalResourceInner createOrUpdate(String resourceUri, String approvalName, ApprovalResourceInner resource, + Context context); + + /** + * List ApprovalResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByParent(String resourceUri); + + /** + * List ApprovalResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByParent(String resourceUri, Context context); + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalResourceInner> beginUpdate(String resourceUri, + String approvalName, ApprovalPatchModel properties); + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalResourceInner> beginUpdate(String resourceUri, + String approvalName, ApprovalPatchModel properties, Context context); + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalResourceInner update(String resourceUri, String approvalName, ApprovalPatchModel properties); + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalResourceInner update(String resourceUri, String approvalName, ApprovalPatchModel properties, + Context context); + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri, String approvalName); + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri, String approvalName, Context context); + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String approvalName); + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String approvalName, Context context); + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> + beginNotifyInitiator(String resourceUri, String approvalName, ApprovalActionRequest body); + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> + beginNotifyInitiator(String resourceUri, String approvalName, ApprovalActionRequest body, Context context); + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner notifyInitiator(String resourceUri, String approvalName, ApprovalActionRequest body); + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner notifyInitiator(String resourceUri, String approvalName, ApprovalActionRequest body, + Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/CommunitiesClient.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/CommunitiesClient.java new file mode 100644 index 000000000000..22e4644b0c68 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/CommunitiesClient.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CheckAddressSpaceAvailabilityResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPatchModel; + +/** + * An instance of this class provides access to all the operations defined in CommunitiesClient. + */ +public interface CommunitiesClient { + /** + * Get a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String communityName, + Context context); + + /** + * Get a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityResourceInner getByResourceGroup(String resourceGroupName, String communityName); + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityResourceInner> beginCreateOrUpdate(String resourceGroupName, + String communityName, CommunityResourceInner resource); + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityResourceInner> beginCreateOrUpdate(String resourceGroupName, + String communityName, CommunityResourceInner resource, Context context); + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityResourceInner createOrUpdate(String resourceGroupName, String communityName, + CommunityResourceInner resource); + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityResourceInner createOrUpdate(String resourceGroupName, String communityName, + CommunityResourceInner resource, Context context); + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityResourceInner> beginUpdate(String resourceGroupName, + String communityName, CommunityPatchModel properties); + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityResourceInner> beginUpdate(String resourceGroupName, + String communityName, CommunityPatchModel properties, Context context); + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityResourceInner update(String resourceGroupName, String communityName, CommunityPatchModel properties); + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityResourceInner update(String resourceGroupName, String communityName, CommunityPatchModel properties, + Context context); + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String communityName); + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String communityName, Context context); + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String communityName); + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String communityName, Context context); + + /** + * List CommunityResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List CommunityResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List CommunityResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List CommunityResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Checks that the IP Address Space to be allocated for this Community is available. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param checkAddressSpaceAvailabilityRequest Check IP Address Space request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of availability of the requested address space along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkAddressSpaceAvailabilityWithResponse( + String resourceGroupName, String communityName, + CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest, Context context); + + /** + * Checks that the IP Address Space to be allocated for this Community is available. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param checkAddressSpaceAvailabilityRequest Check IP Address Space request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of availability of the requested address space. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckAddressSpaceAvailabilityResponseInner checkAddressSpaceAvailability(String resourceGroupName, + String communityName, CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/CommunityEndpointsClient.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/CommunityEndpointsClient.java new file mode 100644 index 000000000000..2dfd13a9a37d --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/CommunityEndpointsClient.java @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityEndpointResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchModel; + +/** + * An instance of this class provides access to all the operations defined in CommunityEndpointsClient. + */ +public interface CommunityEndpointsClient { + /** + * Get a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityEndpointResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, Context context); + + /** + * Get a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityEndpointResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityEndpointResourceInner get(String resourceGroupName, String communityName, String communityEndpointName); + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityEndpointResourceInner> beginCreateOrUpdate( + String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointResourceInner resource); + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityEndpointResourceInner> beginCreateOrUpdate( + String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointResourceInner resource, Context context); + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityEndpointResourceInner createOrUpdate(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointResourceInner resource); + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityEndpointResourceInner createOrUpdate(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointResourceInner resource, Context context); + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityEndpointResourceInner> beginUpdate( + String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointPatchModel properties); + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CommunityEndpointResourceInner> beginUpdate( + String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointPatchModel properties, Context context); + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityEndpointResourceInner update(String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointPatchModel properties); + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CommunityEndpointResourceInner update(String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointPatchModel properties, Context context); + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String communityName, + String communityEndpointName); + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String communityName, + String communityEndpointName, Context context); + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String communityName, String communityEndpointName); + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String communityName, String communityEndpointName, Context context); + + /** + * List CommunityEndpointResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCommunityResource(String resourceGroupName, + String communityName); + + /** + * List CommunityEndpointResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCommunityResource(String resourceGroupName, + String communityName, Context context); + + /** + * List CommunityEndpointResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String communityName); + + /** + * List CommunityEndpointResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String communityName, Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String communityName, String communityEndpointName, ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String communityName, String communityEndpointName, ApprovalCallbackRequest body, + Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String communityName, String communityEndpointName, + ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String communityName, String communityEndpointName, + ApprovalDeletionCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/EnclaveConnectionsClient.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/EnclaveConnectionsClient.java new file mode 100644 index 000000000000..0620448f051b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/EnclaveConnectionsClient.java @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveConnectionResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchModel; + +/** + * An instance of this class provides access to all the operations defined in EnclaveConnectionsClient. + */ +public interface EnclaveConnectionsClient { + /** + * Get a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveConnectionResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String enclaveConnectionName, Context context); + + /** + * Get a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveConnectionResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveConnectionResourceInner getByResourceGroup(String resourceGroupName, String enclaveConnectionName); + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveConnectionResourceInner> beginCreateOrUpdate( + String resourceGroupName, String enclaveConnectionName, EnclaveConnectionResourceInner resource); + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveConnectionResourceInner> beginCreateOrUpdate( + String resourceGroupName, String enclaveConnectionName, EnclaveConnectionResourceInner resource, + Context context); + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveConnectionResourceInner createOrUpdate(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionResourceInner resource); + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveConnectionResourceInner createOrUpdate(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionResourceInner resource, Context context); + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveConnectionResourceInner> + beginUpdate(String resourceGroupName, String enclaveConnectionName, EnclaveConnectionPatchModel properties); + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveConnectionResourceInner> beginUpdate( + String resourceGroupName, String enclaveConnectionName, EnclaveConnectionPatchModel properties, + Context context); + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveConnectionResourceInner update(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionPatchModel properties); + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveConnectionResourceInner update(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionPatchModel properties, Context context); + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String enclaveConnectionName); + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String enclaveConnectionName, + Context context); + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String enclaveConnectionName); + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String enclaveConnectionName, Context context); + + /** + * List EnclaveConnectionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List EnclaveConnectionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List EnclaveConnectionResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List EnclaveConnectionResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String enclaveConnectionName, ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String enclaveConnectionName, ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String enclaveConnectionName, ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String enclaveConnectionName, ApprovalDeletionCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/EnclaveEndpointsClient.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/EnclaveEndpointsClient.java new file mode 100644 index 000000000000..d3ad46b4e408 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/EnclaveEndpointsClient.java @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveEndpointResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchModel; + +/** + * An instance of this class provides access to all the operations defined in EnclaveEndpointsClient. + */ +public interface EnclaveEndpointsClient { + /** + * Get a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveEndpointResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, Context context); + + /** + * Get a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveEndpointResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveEndpointResourceInner get(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName); + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveEndpointResourceInner> beginCreateOrUpdate( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointResourceInner resource); + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveEndpointResourceInner> beginCreateOrUpdate( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointResourceInner resource, Context context); + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveEndpointResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointResourceInner resource); + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveEndpointResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointResourceInner resource, Context context); + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveEndpointResourceInner> beginUpdate( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointPatchModel properties); + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveEndpointResourceInner> beginUpdate( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointPatchModel properties, Context context); + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveEndpointResourceInner update(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointPatchModel properties); + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveEndpointResourceInner update(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointPatchModel properties, Context context); + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName); + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, Context context); + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName); + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, Context context); + + /** + * List EnclaveEndpointResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByEnclaveResource(String resourceGroupName, + String virtualEnclaveName); + + /** + * List EnclaveEndpointResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByEnclaveResource(String resourceGroupName, + String virtualEnclaveName, Context context); + + /** + * List EnclaveEndpointResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String virtualEnclaveName); + + /** + * List EnclaveEndpointResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String virtualEnclaveName, Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body, + Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + ApprovalDeletionCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/OperationsClient.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/OperationsClient.java new file mode 100644 index 000000000000..b499869abb11 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/TransitHubsClient.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/TransitHubsClient.java new file mode 100644 index 000000000000..ba33c1aa6ddb --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/TransitHubsClient.java @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.models.TransitHubResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchModel; + +/** + * An instance of this class provides access to all the operations defined in TransitHubsClient. + */ +public interface TransitHubsClient { + /** + * Get a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TransitHubResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String communityName, + String transitHubName, Context context); + + /** + * Get a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TransitHubResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransitHubResourceInner get(String resourceGroupName, String communityName, String transitHubName); + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TransitHubResourceInner> beginCreateOrUpdate( + String resourceGroupName, String communityName, String transitHubName, TransitHubResourceInner resource); + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TransitHubResourceInner> beginCreateOrUpdate( + String resourceGroupName, String communityName, String transitHubName, TransitHubResourceInner resource, + Context context); + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransitHubResourceInner createOrUpdate(String resourceGroupName, String communityName, String transitHubName, + TransitHubResourceInner resource); + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransitHubResourceInner createOrUpdate(String resourceGroupName, String communityName, String transitHubName, + TransitHubResourceInner resource, Context context); + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TransitHubResourceInner> beginUpdate(String resourceGroupName, + String communityName, String transitHubName, TransitHubPatchModel properties); + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TransitHubResourceInner> beginUpdate(String resourceGroupName, + String communityName, String transitHubName, TransitHubPatchModel properties, Context context); + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransitHubResourceInner update(String resourceGroupName, String communityName, String transitHubName, + TransitHubPatchModel properties); + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransitHubResourceInner update(String resourceGroupName, String communityName, String transitHubName, + TransitHubPatchModel properties, Context context); + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String communityName, + String transitHubName); + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String communityName, + String transitHubName, Context context); + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String communityName, String transitHubName); + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String communityName, String transitHubName, Context context); + + /** + * List TransitHubResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCommunityResource(String resourceGroupName, String communityName); + + /** + * List TransitHubResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCommunityResource(String resourceGroupName, String communityName, + Context context); + + /** + * List TransitHubResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String communityName); + + /** + * List TransitHubResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String communityName, Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/VirtualEnclavesClient.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/VirtualEnclavesClient.java new file mode 100644 index 000000000000..a6e6b44f211a --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/VirtualEnclavesClient.java @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchModel; + +/** + * An instance of this class provides access to all the operations defined in VirtualEnclavesClient. + */ +public interface VirtualEnclavesClient { + /** + * Get a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String virtualEnclaveName, + Context context); + + /** + * Get a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveResourceInner getByResourceGroup(String resourceGroupName, String virtualEnclaveName); + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveResourceInner> beginCreateOrUpdate(String resourceGroupName, + String virtualEnclaveName, EnclaveResourceInner resource); + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveResourceInner> beginCreateOrUpdate(String resourceGroupName, + String virtualEnclaveName, EnclaveResourceInner resource, Context context); + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, + EnclaveResourceInner resource); + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, + EnclaveResourceInner resource, Context context); + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveResourceInner> beginUpdate(String resourceGroupName, + String virtualEnclaveName, VirtualEnclavePatchModel properties); + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, EnclaveResourceInner> beginUpdate(String resourceGroupName, + String virtualEnclaveName, VirtualEnclavePatchModel properties, Context context); + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveResourceInner update(String resourceGroupName, String virtualEnclaveName, + VirtualEnclavePatchModel properties); + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + EnclaveResourceInner update(String resourceGroupName, String virtualEnclaveName, + VirtualEnclavePatchModel properties, Context context); + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName); + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName, + Context context); + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualEnclaveName); + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualEnclaveName, Context context); + + /** + * List EnclaveResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List EnclaveResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List EnclaveResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List EnclaveResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> + beginHandleApprovalCreation(String resourceGroupName, String virtualEnclaveName, ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String virtualEnclaveName, ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String virtualEnclaveName, ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String virtualEnclaveName, ApprovalDeletionCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/VirtualEnclavesManagementClient.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/VirtualEnclavesManagementClient.java new file mode 100644 index 000000000000..c30b4cb4ce98 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/VirtualEnclavesManagementClient.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for VirtualEnclavesManagementClient class. + */ +public interface VirtualEnclavesManagementClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the WorkloadsClient object to access its operations. + * + * @return the WorkloadsClient object. + */ + WorkloadsClient getWorkloads(); + + /** + * Gets the VirtualEnclavesClient object to access its operations. + * + * @return the VirtualEnclavesClient object. + */ + VirtualEnclavesClient getVirtualEnclaves(); + + /** + * Gets the CommunitiesClient object to access its operations. + * + * @return the CommunitiesClient object. + */ + CommunitiesClient getCommunities(); + + /** + * Gets the TransitHubsClient object to access its operations. + * + * @return the TransitHubsClient object. + */ + TransitHubsClient getTransitHubs(); + + /** + * Gets the EnclaveConnectionsClient object to access its operations. + * + * @return the EnclaveConnectionsClient object. + */ + EnclaveConnectionsClient getEnclaveConnections(); + + /** + * Gets the EnclaveEndpointsClient object to access its operations. + * + * @return the EnclaveEndpointsClient object. + */ + EnclaveEndpointsClient getEnclaveEndpoints(); + + /** + * Gets the CommunityEndpointsClient object to access its operations. + * + * @return the CommunityEndpointsClient object. + */ + CommunityEndpointsClient getCommunityEndpoints(); + + /** + * Gets the ApprovalsClient object to access its operations. + * + * @return the ApprovalsClient object. + */ + ApprovalsClient getApprovals(); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/WorkloadsClient.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/WorkloadsClient.java new file mode 100644 index 000000000000..fb9097be03c3 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/WorkloadsClient.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.models.WorkloadResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchModel; + +/** + * An instance of this class provides access to all the operations defined in WorkloadsClient. + */ +public interface WorkloadsClient { + /** + * Get a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String virtualEnclaveName, + String workloadName, Context context); + + /** + * Get a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadResourceInner get(String resourceGroupName, String virtualEnclaveName, String workloadName); + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkloadResourceInner> beginCreateOrUpdate(String resourceGroupName, + String virtualEnclaveName, String workloadName, WorkloadResourceInner resource); + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkloadResourceInner> beginCreateOrUpdate(String resourceGroupName, + String virtualEnclaveName, String workloadName, WorkloadResourceInner resource, Context context); + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, String workloadName, + WorkloadResourceInner resource); + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, String workloadName, + WorkloadResourceInner resource, Context context); + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkloadResourceInner> beginUpdate(String resourceGroupName, + String virtualEnclaveName, String workloadName, WorkloadPatchModel properties); + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkloadResourceInner> beginUpdate(String resourceGroupName, + String virtualEnclaveName, String workloadName, WorkloadPatchModel properties, Context context); + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadResourceInner update(String resourceGroupName, String virtualEnclaveName, String workloadName, + WorkloadPatchModel properties); + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkloadResourceInner update(String resourceGroupName, String virtualEnclaveName, String workloadName, + WorkloadPatchModel properties, Context context); + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName, + String workloadName); + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName, + String workloadName, Context context); + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualEnclaveName, String workloadName); + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String virtualEnclaveName, String workloadName, Context context); + + /** + * List WorkloadResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByEnclaveResource(String resourceGroupName, String virtualEnclaveName); + + /** + * List WorkloadResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByEnclaveResource(String resourceGroupName, String virtualEnclaveName, + Context context); + + /** + * List WorkloadResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String virtualEnclaveName); + + /** + * List WorkloadResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(String virtualEnclaveName, Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/ApprovalActionResponseInner.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/ApprovalActionResponseInner.java new file mode 100644 index 000000000000..1ed54abc165b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/ApprovalActionResponseInner.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response body after handling of approvalCallbackRequest. + */ +@Immutable +public final class ApprovalActionResponseInner implements JsonSerializable { + /* + * Confirmation message indicating the result of the operation. + */ + private String message; + + /** + * Creates an instance of ApprovalActionResponseInner class. + */ + private ApprovalActionResponseInner() { + } + + /** + * Get the message property: Confirmation message indicating the result of the operation. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalActionResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalActionResponseInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApprovalActionResponseInner. + */ + public static ApprovalActionResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalActionResponseInner deserializedApprovalActionResponseInner = new ApprovalActionResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("message".equals(fieldName)) { + deserializedApprovalActionResponseInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalActionResponseInner; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/ApprovalResourceInner.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/ApprovalResourceInner.java new file mode 100644 index 000000000000..b00b53d85188 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/ApprovalResourceInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalProperties; +import java.io.IOException; + +/** + * Approval Model Resource. + */ +@Fluent +public final class ApprovalResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ApprovalProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ApprovalResourceInner class. + */ + public ApprovalResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ApprovalProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ApprovalResourceInner object itself. + */ + public ApprovalResourceInner withProperties(ApprovalProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApprovalResourceInner. + */ + public static ApprovalResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalResourceInner deserializedApprovalResourceInner = new ApprovalResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedApprovalResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedApprovalResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedApprovalResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedApprovalResourceInner.properties = ApprovalProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedApprovalResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalResourceInner; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CheckAddressSpaceAvailabilityResponseInner.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CheckAddressSpaceAvailabilityResponseInner.java new file mode 100644 index 000000000000..9df2eb9e4165 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CheckAddressSpaceAvailabilityResponseInner.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Response of availability of the requested address space. + */ +@Immutable +public final class CheckAddressSpaceAvailabilityResponseInner + implements JsonSerializable { + /* + * Boolean representing whether the address space is available. + */ + private boolean value; + + /** + * Creates an instance of CheckAddressSpaceAvailabilityResponseInner class. + */ + private CheckAddressSpaceAvailabilityResponseInner() { + } + + /** + * Get the value property: Boolean representing whether the address space is available. + * + * @return the value value. + */ + public boolean value() { + return this.value; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckAddressSpaceAvailabilityResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckAddressSpaceAvailabilityResponseInner if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CheckAddressSpaceAvailabilityResponseInner. + */ + public static CheckAddressSpaceAvailabilityResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckAddressSpaceAvailabilityResponseInner deserializedCheckAddressSpaceAvailabilityResponseInner + = new CheckAddressSpaceAvailabilityResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedCheckAddressSpaceAvailabilityResponseInner.value = reader.getBoolean(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckAddressSpaceAvailabilityResponseInner; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CommunityEndpointResourceInner.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CommunityEndpointResourceInner.java new file mode 100644 index 000000000000..e9c4da3ebe61 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CommunityEndpointResourceInner.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProperties; +import java.io.IOException; +import java.util.Map; + +/** + * CommunityEndpoint Model Resource. + */ +@Fluent +public final class CommunityEndpointResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private CommunityEndpointProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CommunityEndpointResourceInner class. + */ + public CommunityEndpointResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public CommunityEndpointProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the CommunityEndpointResourceInner object itself. + */ + public CommunityEndpointResourceInner withProperties(CommunityEndpointProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public CommunityEndpointResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CommunityEndpointResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunityEndpointResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityEndpointResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CommunityEndpointResourceInner. + */ + public static CommunityEndpointResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityEndpointResourceInner deserializedCommunityEndpointResourceInner + = new CommunityEndpointResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCommunityEndpointResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCommunityEndpointResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCommunityEndpointResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCommunityEndpointResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCommunityEndpointResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCommunityEndpointResourceInner.properties + = CommunityEndpointProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCommunityEndpointResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityEndpointResourceInner; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CommunityResourceInner.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CommunityResourceInner.java new file mode 100644 index 000000000000..0dfcd330a616 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CommunityResourceInner.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.models.CommunityProperties; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import java.io.IOException; +import java.util.Map; + +/** + * Community Model Resource. + */ +@Fluent +public final class CommunityResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private CommunityProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CommunityResourceInner class. + */ + public CommunityResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public CommunityProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the CommunityResourceInner object itself. + */ + public CommunityResourceInner withProperties(CommunityProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the CommunityResourceInner object itself. + */ + public CommunityResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public CommunityResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CommunityResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunityResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CommunityResourceInner. + */ + public static CommunityResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityResourceInner deserializedCommunityResourceInner = new CommunityResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCommunityResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCommunityResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCommunityResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCommunityResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCommunityResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCommunityResourceInner.properties = CommunityProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedCommunityResourceInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCommunityResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityResourceInner; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveConnectionResourceInner.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveConnectionResourceInner.java new file mode 100644 index 000000000000..dc2a3790000a --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveConnectionResourceInner.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionProperties; +import java.io.IOException; +import java.util.Map; + +/** + * EnclaveConnection Model Resource. + */ +@Fluent +public final class EnclaveConnectionResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private EnclaveConnectionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of EnclaveConnectionResourceInner class. + */ + public EnclaveConnectionResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public EnclaveConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the EnclaveConnectionResourceInner object itself. + */ + public EnclaveConnectionResourceInner withProperties(EnclaveConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public EnclaveConnectionResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EnclaveConnectionResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveConnectionResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveConnectionResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnclaveConnectionResourceInner. + */ + public static EnclaveConnectionResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveConnectionResourceInner deserializedEnclaveConnectionResourceInner + = new EnclaveConnectionResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEnclaveConnectionResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEnclaveConnectionResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEnclaveConnectionResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedEnclaveConnectionResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEnclaveConnectionResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedEnclaveConnectionResourceInner.properties + = EnclaveConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedEnclaveConnectionResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveConnectionResourceInner; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveEndpointResourceInner.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveEndpointResourceInner.java new file mode 100644 index 000000000000..16b59895be51 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveEndpointResourceInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProperties; +import java.io.IOException; +import java.util.Map; + +/** + * EnclaveEndpoint Model Resource. + */ +@Fluent +public final class EnclaveEndpointResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private EnclaveEndpointProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of EnclaveEndpointResourceInner class. + */ + public EnclaveEndpointResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public EnclaveEndpointProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the EnclaveEndpointResourceInner object itself. + */ + public EnclaveEndpointResourceInner withProperties(EnclaveEndpointProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public EnclaveEndpointResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EnclaveEndpointResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveEndpointResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveEndpointResourceInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnclaveEndpointResourceInner. + */ + public static EnclaveEndpointResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveEndpointResourceInner deserializedEnclaveEndpointResourceInner = new EnclaveEndpointResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEnclaveEndpointResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEnclaveEndpointResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEnclaveEndpointResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedEnclaveEndpointResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEnclaveEndpointResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedEnclaveEndpointResourceInner.properties = EnclaveEndpointProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedEnclaveEndpointResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveEndpointResourceInner; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveResourceInner.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveResourceInner.java new file mode 100644 index 000000000000..af3ee42946a4 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveResourceInner.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclaveProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Virtual Enclave Model Resource. + */ +@Fluent +public final class EnclaveResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private VirtualEnclaveProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of EnclaveResourceInner class. + */ + public EnclaveResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public VirtualEnclaveProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the EnclaveResourceInner object itself. + */ + public EnclaveResourceInner withProperties(VirtualEnclaveProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the EnclaveResourceInner object itself. + */ + public EnclaveResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public EnclaveResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EnclaveResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnclaveResourceInner. + */ + public static EnclaveResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveResourceInner deserializedEnclaveResourceInner = new EnclaveResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedEnclaveResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedEnclaveResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEnclaveResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedEnclaveResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEnclaveResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedEnclaveResourceInner.properties = VirtualEnclaveProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedEnclaveResourceInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedEnclaveResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveResourceInner; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/OperationInner.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/OperationInner.java new file mode 100644 index 000000000000..c83128505535 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.models.ActionType; +import com.azure.resourcemanager.virtualenclaves.models.OperationDisplay; +import com.azure.resourcemanager.virtualenclaves.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/TransitHubResourceInner.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/TransitHubResourceInner.java new file mode 100644 index 000000000000..ee77ad4d0537 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/TransitHubResourceInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubProperties; +import java.io.IOException; +import java.util.Map; + +/** + * TransitHub Model Resource. + */ +@Fluent +public final class TransitHubResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private TransitHubProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TransitHubResourceInner class. + */ + public TransitHubResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public TransitHubProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the TransitHubResourceInner object itself. + */ + public TransitHubResourceInner withProperties(TransitHubProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public TransitHubResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TransitHubResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TransitHubResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TransitHubResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TransitHubResourceInner. + */ + public static TransitHubResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TransitHubResourceInner deserializedTransitHubResourceInner = new TransitHubResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTransitHubResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTransitHubResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTransitHubResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedTransitHubResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTransitHubResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedTransitHubResourceInner.properties = TransitHubProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedTransitHubResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTransitHubResourceInner; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/WorkloadResourceInner.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/WorkloadResourceInner.java new file mode 100644 index 000000000000..1df6ed7dca26 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/WorkloadResourceInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Workload Model Resource. + */ +@Fluent +public final class WorkloadResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private WorkloadProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of WorkloadResourceInner class. + */ + public WorkloadResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public WorkloadProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the WorkloadResourceInner object itself. + */ + public WorkloadResourceInner withProperties(WorkloadProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public WorkloadResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public WorkloadResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkloadResourceInner. + */ + public static WorkloadResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadResourceInner deserializedWorkloadResourceInner = new WorkloadResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkloadResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkloadResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkloadResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedWorkloadResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedWorkloadResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedWorkloadResourceInner.properties = WorkloadProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedWorkloadResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadResourceInner; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/package-info.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/package-info.java new file mode 100644 index 000000000000..22472d3a9b2b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for VirtualEnclavesManagementClient. + * Microsoft Mission Resource Provider management API. + */ +package com.azure.resourcemanager.virtualenclaves.fluent.models; diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/package-info.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/package-info.java new file mode 100644 index 000000000000..9f8b7b12eaa7 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for VirtualEnclavesManagementClient. + * Microsoft Mission Resource Provider management API. + */ +package com.azure.resourcemanager.virtualenclaves.fluent; diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalActionResponseImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalActionResponseImpl.java new file mode 100644 index 000000000000..66705e5c7aa4 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalActionResponseImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; + +public final class ApprovalActionResponseImpl implements ApprovalActionResponse { + private ApprovalActionResponseInner innerObject; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + ApprovalActionResponseImpl(ApprovalActionResponseInner innerObject, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String message() { + return this.innerModel().message(); + } + + public ApprovalActionResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalResourceImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalResourceImpl.java new file mode 100644 index 000000000000..2657514fccdb --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalResourceImpl.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalProperties; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalResource; + +public final class ApprovalResourceImpl + implements ApprovalResource, ApprovalResource.Definition, ApprovalResource.Update { + private ApprovalResourceInner innerObject; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ApprovalProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ApprovalResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String approvalName; + + private ApprovalPatchModel updateProperties; + + public ApprovalResourceImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public ApprovalResource create() { + this.innerObject = serviceManager.serviceClient() + .getApprovals() + .createOrUpdate(resourceUri, approvalName, this.innerModel(), Context.NONE); + return this; + } + + public ApprovalResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getApprovals() + .createOrUpdate(resourceUri, approvalName, this.innerModel(), context); + return this; + } + + ApprovalResourceImpl(String name, com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = new ApprovalResourceInner(); + this.serviceManager = serviceManager; + this.approvalName = name; + } + + public ApprovalResourceImpl update() { + this.updateProperties = new ApprovalPatchModel(); + return this; + } + + public ApprovalResource apply() { + this.innerObject = serviceManager.serviceClient() + .getApprovals() + .update(resourceUri, approvalName, updateProperties, Context.NONE); + return this; + } + + public ApprovalResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getApprovals() + .update(resourceUri, approvalName, updateProperties, context); + return this; + } + + ApprovalResourceImpl(ApprovalResourceInner innerObject, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}", "resourceUri"); + this.approvalName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}", "approvalName"); + } + + public ApprovalResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getApprovals() + .getWithResponse(resourceUri, approvalName, Context.NONE) + .getValue(); + return this; + } + + public ApprovalResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getApprovals() + .getWithResponse(resourceUri, approvalName, context) + .getValue(); + return this; + } + + public ApprovalActionResponse notifyInitiator(ApprovalActionRequest body) { + return serviceManager.approvals().notifyInitiator(resourceUri, approvalName, body); + } + + public ApprovalActionResponse notifyInitiator(ApprovalActionRequest body, Context context) { + return serviceManager.approvals().notifyInitiator(resourceUri, approvalName, body, context); + } + + public ApprovalResourceImpl withProperties(ApprovalProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public ApprovalResourceImpl withProperties(ApprovalPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalsClientImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalsClientImpl.java new file mode 100644 index 000000000000..0932a3f7a006 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalsClientImpl.java @@ -0,0 +1,1106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalResourceInner; +import com.azure.resourcemanager.virtualenclaves.implementation.models.ApprovalResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchModel; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in ApprovalsClient. + */ +public final class ApprovalsClientImpl implements ApprovalsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ApprovalsService service; + + /** + * The service client containing this operation class. + */ + private final VirtualEnclavesManagementClientImpl client; + + /** + * Initializes an instance of ApprovalsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApprovalsClientImpl(VirtualEnclavesManagementClientImpl client) { + this.service + = RestProxy.create(ApprovalsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for VirtualEnclavesManagementClientApprovals to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VirtualEnclavesManagementClientApprovals") + public interface ApprovalsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, @HeaderParam("Accept") String accept, Context context); + + @Put("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApprovalResourceInner resource, + Context context); + + @Put("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApprovalResourceInner resource, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Mission/approvals") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByParent(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Mission/approvals") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByParentSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Patch("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApprovalPatchModel properties, + Context context); + + @Patch("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApprovalPatchModel properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, Context context); + + @Post("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}/notifyInitiator") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> notifyInitiator(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApprovalActionRequest body, + Context context); + + @Post("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}/notifyInitiator") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response notifyInitiatorSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApprovalActionRequest body, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByParentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByParentNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ApprovalResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String approvalName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + approvalName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ApprovalResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String approvalName) { + return getWithResponseAsync(resourceUri, approvalName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ApprovalResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String approvalName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, approvalName, + accept, context); + } + + /** + * Get a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ApprovalResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalResourceInner get(String resourceUri, String approvalName) { + return getWithResponse(resourceUri, approvalName, Context.NONE).getValue(); + } + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, String approvalName, + ApprovalResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, approvalName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, String approvalName, + ApprovalResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + approvalName, contentType, accept, resource, Context.NONE); + } + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, String approvalName, + ApprovalResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + approvalName, contentType, accept, resource, context); + } + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalResourceInner> + beginCreateOrUpdateAsync(String resourceUri, String approvalName, ApprovalResourceInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceUri, approvalName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalResourceInner.class, ApprovalResourceInner.class, + this.client.getContext()); + } + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalResourceInner> beginCreateOrUpdate(String resourceUri, + String approvalName, ApprovalResourceInner resource) { + Response response = createOrUpdateWithResponse(resourceUri, approvalName, resource); + return this.client.getLroResult(response, + ApprovalResourceInner.class, ApprovalResourceInner.class, Context.NONE); + } + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalResourceInner> beginCreateOrUpdate(String resourceUri, + String approvalName, ApprovalResourceInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceUri, approvalName, resource, context); + return this.client.getLroResult(response, + ApprovalResourceInner.class, ApprovalResourceInner.class, context); + } + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String approvalName, + ApprovalResourceInner resource) { + return beginCreateOrUpdateAsync(resourceUri, approvalName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalResourceInner createOrUpdate(String resourceUri, String approvalName, + ApprovalResourceInner resource) { + return beginCreateOrUpdate(resourceUri, approvalName, resource).getFinalResult(); + } + + /** + * Create a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalResourceInner createOrUpdate(String resourceUri, String approvalName, ApprovalResourceInner resource, + Context context) { + return beginCreateOrUpdate(resourceUri, approvalName, resource, context).getFinalResult(); + } + + /** + * List ApprovalResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentSinglePageAsync(String resourceUri) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByParent(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List ApprovalResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByParentAsync(String resourceUri) { + return new PagedFlux<>(() -> listByParentSinglePageAsync(resourceUri), + nextLink -> listByParentNextSinglePageAsync(nextLink)); + } + + /** + * List ApprovalResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByParentSinglePage(String resourceUri) { + final String accept = "application/json"; + Response res = service.listByParentSync(this.client.getEndpoint(), + this.client.getApiVersion(), resourceUri, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ApprovalResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByParentSinglePage(String resourceUri, Context context) { + final String accept = "application/json"; + Response res = service.listByParentSync(this.client.getEndpoint(), + this.client.getApiVersion(), resourceUri, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ApprovalResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByParent(String resourceUri) { + return new PagedIterable<>(() -> listByParentSinglePage(resourceUri), + nextLink -> listByParentNextSinglePage(nextLink)); + } + + /** + * List ApprovalResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByParent(String resourceUri, Context context) { + return new PagedIterable<>(() -> listByParentSinglePage(resourceUri, context), + nextLink -> listByParentNextSinglePage(nextLink, context)); + } + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceUri, String approvalName, + ApprovalPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + approvalName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceUri, String approvalName, + ApprovalPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, approvalName, + contentType, accept, properties, Context.NONE); + } + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceUri, String approvalName, + ApprovalPatchModel properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, approvalName, + contentType, accept, properties, context); + } + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalResourceInner> beginUpdateAsync(String resourceUri, + String approvalName, ApprovalPatchModel properties) { + Mono>> mono = updateWithResponseAsync(resourceUri, approvalName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalResourceInner.class, ApprovalResourceInner.class, + this.client.getContext()); + } + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalResourceInner> beginUpdate(String resourceUri, + String approvalName, ApprovalPatchModel properties) { + Response response = updateWithResponse(resourceUri, approvalName, properties); + return this.client.getLroResult(response, + ApprovalResourceInner.class, ApprovalResourceInner.class, Context.NONE); + } + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalResourceInner> beginUpdate(String resourceUri, + String approvalName, ApprovalPatchModel properties, Context context) { + Response response = updateWithResponse(resourceUri, approvalName, properties, context); + return this.client.getLroResult(response, + ApprovalResourceInner.class, ApprovalResourceInner.class, context); + } + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceUri, String approvalName, + ApprovalPatchModel properties) { + return beginUpdateAsync(resourceUri, approvalName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalResourceInner update(String resourceUri, String approvalName, ApprovalPatchModel properties) { + return beginUpdate(resourceUri, approvalName, properties).getFinalResult(); + } + + /** + * Update a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalResourceInner update(String resourceUri, String approvalName, ApprovalPatchModel properties, + Context context) { + return beginUpdate(resourceUri, approvalName, properties, context).getFinalResult(); + } + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceUri, String approvalName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + approvalName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri, String approvalName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, approvalName, + Context.NONE); + } + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri, String approvalName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, approvalName, + context); + } + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceUri, String approvalName) { + Mono>> mono = deleteWithResponseAsync(resourceUri, approvalName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri, String approvalName) { + Response response = deleteWithResponse(resourceUri, approvalName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri, String approvalName, Context context) { + Response response = deleteWithResponse(resourceUri, approvalName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceUri, String approvalName) { + return beginDeleteAsync(resourceUri, approvalName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String approvalName) { + beginDelete(resourceUri, approvalName).getFinalResult(); + } + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String approvalName, Context context) { + beginDelete(resourceUri, approvalName, context).getFinalResult(); + } + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> notifyInitiatorWithResponseAsync(String resourceUri, String approvalName, + ApprovalActionRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.notifyInitiator(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, approvalName, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response notifyInitiatorWithResponse(String resourceUri, String approvalName, + ApprovalActionRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.notifyInitiatorSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + approvalName, contentType, accept, body, Context.NONE); + } + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response notifyInitiatorWithResponse(String resourceUri, String approvalName, + ApprovalActionRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.notifyInitiatorSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + approvalName, contentType, accept, body, context); + } + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalActionResponseInner> + beginNotifyInitiatorAsync(String resourceUri, String approvalName, ApprovalActionRequest body) { + Mono>> mono = notifyInitiatorWithResponseAsync(resourceUri, approvalName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, + this.client.getContext()); + } + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> + beginNotifyInitiator(String resourceUri, String approvalName, ApprovalActionRequest body) { + Response response = notifyInitiatorWithResponse(resourceUri, approvalName, body); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, Context.NONE); + } + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> + beginNotifyInitiator(String resourceUri, String approvalName, ApprovalActionRequest body, Context context) { + Response response = notifyInitiatorWithResponse(resourceUri, approvalName, body, context); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, context); + } + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono notifyInitiatorAsync(String resourceUri, String approvalName, + ApprovalActionRequest body) { + return beginNotifyInitiatorAsync(resourceUri, approvalName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner notifyInitiator(String resourceUri, String approvalName, + ApprovalActionRequest body) { + return beginNotifyInitiator(resourceUri, approvalName, body).getFinalResult(); + } + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner notifyInitiator(String resourceUri, String approvalName, + ApprovalActionRequest body, Context context) { + return beginNotifyInitiator(resourceUri, approvalName, body, context).getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByParentNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByParentNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByParentNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByParentNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByParentNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalsImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalsImpl.java new file mode 100644 index 000000000000..64da15abcca1 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalsImpl.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalResource; +import com.azure.resourcemanager.virtualenclaves.models.Approvals; + +public final class ApprovalsImpl implements Approvals { + private static final ClientLogger LOGGER = new ClientLogger(ApprovalsImpl.class); + + private final ApprovalsClient innerClient; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public ApprovalsImpl(ApprovalsClient innerClient, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceUri, String approvalName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceUri, approvalName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ApprovalResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ApprovalResource get(String resourceUri, String approvalName) { + ApprovalResourceInner inner = this.serviceClient().get(resourceUri, approvalName); + if (inner != null) { + return new ApprovalResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByParent(String resourceUri) { + PagedIterable inner = this.serviceClient().listByParent(resourceUri); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApprovalResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByParent(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().listByParent(resourceUri, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ApprovalResourceImpl(inner1, this.manager())); + } + + public void deleteByResourceGroup(String resourceUri, String approvalName) { + this.serviceClient().delete(resourceUri, approvalName); + } + + public void delete(String resourceUri, String approvalName, Context context) { + this.serviceClient().delete(resourceUri, approvalName, context); + } + + public ApprovalActionResponse notifyInitiator(String resourceUri, String approvalName, ApprovalActionRequest body) { + ApprovalActionResponseInner inner = this.serviceClient().notifyInitiator(resourceUri, approvalName, body); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse notifyInitiator(String resourceUri, String approvalName, ApprovalActionRequest body, + Context context) { + ApprovalActionResponseInner inner + = this.serviceClient().notifyInitiator(resourceUri, approvalName, body, context); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalResource getById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String approvalName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}", "approvalName"); + if (approvalName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'approvals'.", id))); + } + return this.getWithResponse(resourceUri, approvalName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String approvalName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}", "approvalName"); + if (approvalName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'approvals'.", id))); + } + return this.getWithResponse(resourceUri, approvalName, context); + } + + public void deleteById(String id) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String approvalName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}", "approvalName"); + if (approvalName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'approvals'.", id))); + } + this.delete(resourceUri, approvalName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceUri = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String approvalName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}", "approvalName"); + if (approvalName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'approvals'.", id))); + } + this.delete(resourceUri, approvalName, context); + } + + private ApprovalsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + public ApprovalResourceImpl define(String name) { + return new ApprovalResourceImpl(name, this.manager()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CheckAddressSpaceAvailabilityResponseImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CheckAddressSpaceAvailabilityResponseImpl.java new file mode 100644 index 000000000000..b849148cfc76 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CheckAddressSpaceAvailabilityResponseImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.resourcemanager.virtualenclaves.fluent.models.CheckAddressSpaceAvailabilityResponseInner; +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityResponse; + +public final class CheckAddressSpaceAvailabilityResponseImpl implements CheckAddressSpaceAvailabilityResponse { + private CheckAddressSpaceAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + CheckAddressSpaceAvailabilityResponseImpl(CheckAddressSpaceAvailabilityResponseInner innerObject, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public boolean value() { + return this.innerModel().value(); + } + + public CheckAddressSpaceAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunitiesClientImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunitiesClientImpl.java new file mode 100644 index 000000000000..59fb39576b54 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunitiesClientImpl.java @@ -0,0 +1,1210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CheckAddressSpaceAvailabilityResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityResourceInner; +import com.azure.resourcemanager.virtualenclaves.implementation.models.CommunityResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPatchModel; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CommunitiesClient. + */ +public final class CommunitiesClientImpl implements CommunitiesClient { + /** + * The proxy service used to perform REST calls. + */ + private final CommunitiesService service; + + /** + * The service client containing this operation class. + */ + private final VirtualEnclavesManagementClientImpl client; + + /** + * Initializes an instance of CommunitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CommunitiesClientImpl(VirtualEnclavesManagementClientImpl client) { + this.service + = RestProxy.create(CommunitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for VirtualEnclavesManagementClientCommunities to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VirtualEnclavesManagementClientCommunities") + public interface CommunitiesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CommunityResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CommunityResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CommunityPatchModel properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CommunityPatchModel properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/communities") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/communities") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/checkAddressSpaceAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkAddressSpaceAvailability( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/checkAddressSpaceAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response checkAddressSpaceAvailabilitySync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String communityName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String communityName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, communityName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String communityName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, accept, context); + } + + /** + * Get a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityResourceInner getByResourceGroup(String resourceGroupName, String communityName) { + return getByResourceGroupWithResponse(resourceGroupName, communityName, Context.NONE).getValue(); + } + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String communityName, CommunityResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String communityName, + CommunityResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String communityName, + CommunityResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, contentType, accept, resource, context); + } + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunityResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String communityName, CommunityResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, communityName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CommunityResourceInner.class, CommunityResourceInner.class, + this.client.getContext()); + } + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityResourceInner> + beginCreateOrUpdate(String resourceGroupName, String communityName, CommunityResourceInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, communityName, resource); + return this.client.getLroResult(response, + CommunityResourceInner.class, CommunityResourceInner.class, Context.NONE); + } + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityResourceInner> beginCreateOrUpdate( + String resourceGroupName, String communityName, CommunityResourceInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, communityName, resource, context); + return this.client.getLroResult(response, + CommunityResourceInner.class, CommunityResourceInner.class, context); + } + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String communityName, + CommunityResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, communityName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityResourceInner createOrUpdate(String resourceGroupName, String communityName, + CommunityResourceInner resource) { + return beginCreateOrUpdate(resourceGroupName, communityName, resource).getFinalResult(); + } + + /** + * Create a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityResourceInner createOrUpdate(String resourceGroupName, String communityName, + CommunityResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, communityName, resource, context).getFinalResult(); + } + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String communityName, + CommunityPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String communityName, + CommunityPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, contentType, accept, properties, + Context.NONE); + } + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String communityName, + CommunityPatchModel properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, contentType, accept, properties, + context); + } + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunityResourceInner> + beginUpdateAsync(String resourceGroupName, String communityName, CommunityPatchModel properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, communityName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CommunityResourceInner.class, CommunityResourceInner.class, + this.client.getContext()); + } + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityResourceInner> beginUpdate(String resourceGroupName, + String communityName, CommunityPatchModel properties) { + Response response = updateWithResponse(resourceGroupName, communityName, properties); + return this.client.getLroResult(response, + CommunityResourceInner.class, CommunityResourceInner.class, Context.NONE); + } + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityResourceInner> beginUpdate(String resourceGroupName, + String communityName, CommunityPatchModel properties, Context context) { + Response response = updateWithResponse(resourceGroupName, communityName, properties, context); + return this.client.getLroResult(response, + CommunityResourceInner.class, CommunityResourceInner.class, context); + } + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String communityName, + CommunityPatchModel properties) { + return beginUpdateAsync(resourceGroupName, communityName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityResourceInner update(String resourceGroupName, String communityName, + CommunityPatchModel properties) { + return beginUpdate(resourceGroupName, communityName, properties).getFinalResult(); + } + + /** + * Update a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return community Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityResourceInner update(String resourceGroupName, String communityName, CommunityPatchModel properties, + Context context) { + return beginUpdate(resourceGroupName, communityName, properties, context).getFinalResult(); + } + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String communityName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String communityName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, Context.NONE); + } + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String communityName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, context); + } + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String communityName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, communityName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String communityName) { + Response response = deleteWithResponse(resourceGroupName, communityName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String communityName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, communityName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communityName) { + return beginDeleteAsync(resourceGroupName, communityName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String communityName) { + beginDelete(resourceGroupName, communityName).getFinalResult(); + } + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String communityName, Context context) { + beginDelete(resourceGroupName, communityName, context).getFinalResult(); + } + + /** + * List CommunityResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List CommunityResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List CommunityResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List CommunityResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List CommunityResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List CommunityResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List CommunityResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List CommunityResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List CommunityResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List CommunityResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List CommunityResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List CommunityResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Checks that the IP Address Space to be allocated for this Community is available. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param checkAddressSpaceAvailabilityRequest Check IP Address Space request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of availability of the requested address space along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkAddressSpaceAvailabilityWithResponseAsync( + String resourceGroupName, String communityName, + CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkAddressSpaceAvailability(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, communityName, + contentType, accept, checkAddressSpaceAvailabilityRequest, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks that the IP Address Space to be allocated for this Community is available. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param checkAddressSpaceAvailabilityRequest Check IP Address Space request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of availability of the requested address space on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkAddressSpaceAvailabilityAsync( + String resourceGroupName, String communityName, + CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest) { + return checkAddressSpaceAvailabilityWithResponseAsync(resourceGroupName, communityName, + checkAddressSpaceAvailabilityRequest).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Checks that the IP Address Space to be allocated for this Community is available. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param checkAddressSpaceAvailabilityRequest Check IP Address Space request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of availability of the requested address space along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkAddressSpaceAvailabilityWithResponse( + String resourceGroupName, String communityName, + CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.checkAddressSpaceAvailabilitySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, contentType, accept, + checkAddressSpaceAvailabilityRequest, context); + } + + /** + * Checks that the IP Address Space to be allocated for this Community is available. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param checkAddressSpaceAvailabilityRequest Check IP Address Space request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of availability of the requested address space. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckAddressSpaceAvailabilityResponseInner checkAddressSpaceAvailability(String resourceGroupName, + String communityName, CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest) { + return checkAddressSpaceAvailabilityWithResponse(resourceGroupName, communityName, + checkAddressSpaceAvailabilityRequest, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunitiesImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunitiesImpl.java new file mode 100644 index 000000000000..f8242ccc3a99 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunitiesImpl.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CheckAddressSpaceAvailabilityResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityResponse; +import com.azure.resourcemanager.virtualenclaves.models.Communities; +import com.azure.resourcemanager.virtualenclaves.models.CommunityResource; + +public final class CommunitiesImpl implements Communities { + private static final ClientLogger LOGGER = new ClientLogger(CommunitiesImpl.class); + + private final CommunitiesClient innerClient; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public CommunitiesImpl(CommunitiesClient innerClient, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String communityName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, communityName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CommunityResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CommunityResource getByResourceGroup(String resourceGroupName, String communityName) { + CommunityResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, communityName); + if (inner != null) { + return new CommunityResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String communityName) { + this.serviceClient().delete(resourceGroupName, communityName); + } + + public void delete(String resourceGroupName, String communityName, Context context) { + this.serviceClient().delete(resourceGroupName, communityName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CommunityResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CommunityResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CommunityResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CommunityResourceImpl(inner1, this.manager())); + } + + public Response checkAddressSpaceAvailabilityWithResponse( + String resourceGroupName, String communityName, + CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest, Context context) { + Response inner = this.serviceClient() + .checkAddressSpaceAvailabilityWithResponse(resourceGroupName, communityName, + checkAddressSpaceAvailabilityRequest, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckAddressSpaceAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckAddressSpaceAvailabilityResponse checkAddressSpaceAvailability(String resourceGroupName, + String communityName, CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest) { + CheckAddressSpaceAvailabilityResponseInner inner = this.serviceClient() + .checkAddressSpaceAvailability(resourceGroupName, communityName, checkAddressSpaceAvailabilityRequest); + if (inner != null) { + return new CheckAddressSpaceAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public CommunityResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, communityName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, communityName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + this.delete(resourceGroupName, communityName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + this.delete(resourceGroupName, communityName, context); + } + + private CommunitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + public CommunityResourceImpl define(String name) { + return new CommunityResourceImpl(name, this.manager()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointResourceImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointResourceImpl.java new file mode 100644 index 000000000000..8c1ef0202085 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointResourceImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityEndpointResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointResource; +import java.util.Collections; +import java.util.Map; + +public final class CommunityEndpointResourceImpl + implements CommunityEndpointResource, CommunityEndpointResource.Definition, CommunityEndpointResource.Update { + private CommunityEndpointResourceInner innerObject; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public CommunityEndpointProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CommunityEndpointResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String communityName; + + private String communityEndpointName; + + private CommunityEndpointPatchModel updateProperties; + + public CommunityEndpointResourceImpl withExistingCommunity(String resourceGroupName, String communityName) { + this.resourceGroupName = resourceGroupName; + this.communityName = communityName; + return this; + } + + public CommunityEndpointResource create() { + this.innerObject = serviceManager.serviceClient() + .getCommunityEndpoints() + .createOrUpdate(resourceGroupName, communityName, communityEndpointName, this.innerModel(), Context.NONE); + return this; + } + + public CommunityEndpointResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCommunityEndpoints() + .createOrUpdate(resourceGroupName, communityName, communityEndpointName, this.innerModel(), context); + return this; + } + + CommunityEndpointResourceImpl(String name, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = new CommunityEndpointResourceInner(); + this.serviceManager = serviceManager; + this.communityEndpointName = name; + } + + public CommunityEndpointResourceImpl update() { + this.updateProperties = new CommunityEndpointPatchModel(); + return this; + } + + public CommunityEndpointResource apply() { + this.innerObject = serviceManager.serviceClient() + .getCommunityEndpoints() + .update(resourceGroupName, communityName, communityEndpointName, updateProperties, Context.NONE); + return this; + } + + public CommunityEndpointResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCommunityEndpoints() + .update(resourceGroupName, communityName, communityEndpointName, updateProperties, context); + return this; + } + + CommunityEndpointResourceImpl(CommunityEndpointResourceInner innerObject, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.communityName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "communities"); + this.communityEndpointName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "communityEndpoints"); + } + + public CommunityEndpointResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getCommunityEndpoints() + .getWithResponse(resourceGroupName, communityName, communityEndpointName, Context.NONE) + .getValue(); + return this; + } + + public CommunityEndpointResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCommunityEndpoints() + .getWithResponse(resourceGroupName, communityName, communityEndpointName, context) + .getValue(); + return this; + } + + public ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body) { + return serviceManager.communityEndpoints() + .handleApprovalCreation(resourceGroupName, communityName, communityEndpointName, body); + } + + public ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body, Context context) { + return serviceManager.communityEndpoints() + .handleApprovalCreation(resourceGroupName, communityName, communityEndpointName, body, context); + } + + public ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body) { + return serviceManager.communityEndpoints() + .handleApprovalDeletion(resourceGroupName, communityName, communityEndpointName, body); + } + + public ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body, Context context) { + return serviceManager.communityEndpoints() + .handleApprovalDeletion(resourceGroupName, communityName, communityEndpointName, body, context); + } + + public CommunityEndpointResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CommunityEndpointResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CommunityEndpointResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public CommunityEndpointResourceImpl withProperties(CommunityEndpointProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public CommunityEndpointResourceImpl withProperties(CommunityEndpointPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointsClientImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointsClientImpl.java new file mode 100644 index 000000000000..907e640ecc56 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointsClientImpl.java @@ -0,0 +1,1629 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityEndpointResourceInner; +import com.azure.resourcemanager.virtualenclaves.implementation.models.CommunityEndpointResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchModel; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CommunityEndpointsClient. + */ +public final class CommunityEndpointsClientImpl implements CommunityEndpointsClient { + /** + * The proxy service used to perform REST calls. + */ + private final CommunityEndpointsService service; + + /** + * The service client containing this operation class. + */ + private final VirtualEnclavesManagementClientImpl client; + + /** + * Initializes an instance of CommunityEndpointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CommunityEndpointsClientImpl(VirtualEnclavesManagementClientImpl client) { + this.service = RestProxy.create(CommunityEndpointsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for VirtualEnclavesManagementClientCommunityEndpoints to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VirtualEnclavesManagementClientCommunityEndpoints") + public interface CommunityEndpointsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CommunityEndpointResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CommunityEndpointResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CommunityEndpointPatchModel properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CommunityEndpointPatchModel properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCommunityResource( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCommunityResourceSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("communityName") String communityName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("communityName") String communityName, @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}/handleApprovalCreation") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> handleApprovalCreation(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalCallbackRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}/handleApprovalCreation") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response handleApprovalCreationSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalCallbackRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}/handleApprovalDeletion") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> handleApprovalDeletion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalDeletionCallbackRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}/handleApprovalDeletion") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response handleApprovalDeletionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalDeletionCallbackRequest body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCommunityResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCommunityResourceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityEndpointResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String communityName, String communityEndpointName) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityEndpointResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String communityName, + String communityEndpointName) { + return getWithResponseAsync(resourceGroupName, communityName, communityEndpointName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityEndpointResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communityName, communityEndpointName, accept, context); + } + + /** + * Get a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityEndpointResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityEndpointResourceInner get(String resourceGroupName, String communityName, + String communityEndpointName) { + return getWithResponse(resourceGroupName, communityName, communityEndpointName, Context.NONE).getValue(); + } + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String communityName, String communityEndpointName, CommunityEndpointResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, contentType, + accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, contentType, + accept, resource, Context.NONE); + } + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, contentType, + accept, resource, context); + } + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunityEndpointResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, communityName, communityEndpointName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CommunityEndpointResourceInner.class, CommunityEndpointResourceInner.class, + this.client.getContext()); + } + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityEndpointResourceInner> beginCreateOrUpdate( + String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointResourceInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, communityName, communityEndpointName, resource); + return this.client.getLroResult(response, + CommunityEndpointResourceInner.class, CommunityEndpointResourceInner.class, Context.NONE); + } + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityEndpointResourceInner> beginCreateOrUpdate( + String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointResourceInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, communityName, communityEndpointName, resource, context); + return this.client.getLroResult(response, + CommunityEndpointResourceInner.class, CommunityEndpointResourceInner.class, context); + } + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, communityName, communityEndpointName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityEndpointResourceInner createOrUpdate(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointResourceInner resource) { + return beginCreateOrUpdate(resourceGroupName, communityName, communityEndpointName, resource).getFinalResult(); + } + + /** + * Create a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityEndpointResourceInner createOrUpdate(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, communityName, communityEndpointName, resource, context) + .getFinalResult(); + } + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, contentType, + accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, contentType, + accept, properties, Context.NONE); + } + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointPatchModel properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, contentType, + accept, properties, context); + } + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunityEndpointResourceInner> beginUpdateAsync( + String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointPatchModel properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, communityName, communityEndpointName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CommunityEndpointResourceInner.class, CommunityEndpointResourceInner.class, + this.client.getContext()); + } + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityEndpointResourceInner> beginUpdate( + String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointPatchModel properties) { + Response response + = updateWithResponse(resourceGroupName, communityName, communityEndpointName, properties); + return this.client.getLroResult(response, + CommunityEndpointResourceInner.class, CommunityEndpointResourceInner.class, Context.NONE); + } + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityEndpointResourceInner> beginUpdate( + String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointPatchModel properties, Context context) { + Response response + = updateWithResponse(resourceGroupName, communityName, communityEndpointName, properties, context); + return this.client.getLroResult(response, + CommunityEndpointResourceInner.class, CommunityEndpointResourceInner.class, context); + } + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointPatchModel properties) { + return beginUpdateAsync(resourceGroupName, communityName, communityEndpointName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityEndpointResourceInner update(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointPatchModel properties) { + return beginUpdate(resourceGroupName, communityName, communityEndpointName, properties).getFinalResult(); + } + + /** + * Update a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CommunityEndpointResourceInner update(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointPatchModel properties, Context context) { + return beginUpdate(resourceGroupName, communityName, communityEndpointName, properties, context) + .getFinalResult(); + } + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String communityName, + String communityEndpointName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String communityName, + String communityEndpointName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, Context.NONE); + } + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, context); + } + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String communityName, + String communityEndpointName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, communityName, communityEndpointName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String communityName, + String communityEndpointName) { + Response response = deleteWithResponse(resourceGroupName, communityName, communityEndpointName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String communityName, + String communityEndpointName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, communityName, communityEndpointName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communityName, String communityEndpointName) { + return beginDeleteAsync(resourceGroupName, communityName, communityEndpointName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String communityName, String communityEndpointName) { + beginDelete(resourceGroupName, communityName, communityEndpointName).getFinalResult(); + } + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String communityName, String communityEndpointName, Context context) { + beginDelete(resourceGroupName, communityName, communityEndpointName, context).getFinalResult(); + } + + /** + * List CommunityEndpointResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCommunityResourceSinglePageAsync(String resourceGroupName, String communityName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCommunityResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List CommunityEndpointResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCommunityResourceAsync(String resourceGroupName, + String communityName) { + return new PagedFlux<>(() -> listByCommunityResourceSinglePageAsync(resourceGroupName, communityName), + nextLink -> listByCommunityResourceNextSinglePageAsync(nextLink)); + } + + /** + * List CommunityEndpointResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCommunityResourceSinglePage(String resourceGroupName, + String communityName) { + final String accept = "application/json"; + Response res + = service.listByCommunityResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List CommunityEndpointResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCommunityResourceSinglePage(String resourceGroupName, + String communityName, Context context) { + final String accept = "application/json"; + Response res + = service.listByCommunityResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List CommunityEndpointResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCommunityResource(String resourceGroupName, + String communityName) { + return new PagedIterable<>(() -> listByCommunityResourceSinglePage(resourceGroupName, communityName), + nextLink -> listByCommunityResourceNextSinglePage(nextLink)); + } + + /** + * List CommunityEndpointResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCommunityResource(String resourceGroupName, + String communityName, Context context) { + return new PagedIterable<>(() -> listByCommunityResourceSinglePage(resourceGroupName, communityName, context), + nextLink -> listByCommunityResourceNextSinglePage(nextLink, context)); + } + + /** + * List CommunityEndpointResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySubscriptionSinglePageAsync(String communityName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), communityName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List CommunityEndpointResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String communityName) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(communityName), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List CommunityEndpointResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(String communityName) { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), communityName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List CommunityEndpointResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(String communityName, + Context context) { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), communityName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List CommunityEndpointResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String communityName) { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(communityName), + nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List CommunityEndpointResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String communityName, Context context) { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(communityName, context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> handleApprovalCreationWithResponseAsync(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.handleApprovalCreation(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, communityName, + communityEndpointName, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalCreationWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalCreationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, contentType, + accept, body, Context.NONE); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalCreationWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalCreationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, contentType, + accept, body, context); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalActionResponseInner> + beginHandleApprovalCreationAsync(String resourceGroupName, String communityName, String communityEndpointName, + ApprovalCallbackRequest body) { + Mono>> mono + = handleApprovalCreationWithResponseAsync(resourceGroupName, communityName, communityEndpointName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, + this.client.getContext()); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String communityName, String communityEndpointName, ApprovalCallbackRequest body) { + Response response + = handleApprovalCreationWithResponse(resourceGroupName, communityName, communityEndpointName, body); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, Context.NONE); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String communityName, String communityEndpointName, ApprovalCallbackRequest body, + Context context) { + Response response = handleApprovalCreationWithResponse(resourceGroupName, communityName, + communityEndpointName, body, context); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, context); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono handleApprovalCreationAsync(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalCallbackRequest body) { + return beginHandleApprovalCreationAsync(resourceGroupName, communityName, communityEndpointName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body) { + return beginHandleApprovalCreation(resourceGroupName, communityName, communityEndpointName, body) + .getFinalResult(); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body, Context context) { + return beginHandleApprovalCreation(resourceGroupName, communityName, communityEndpointName, body, context) + .getFinalResult(); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> handleApprovalDeletionWithResponseAsync(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalDeletionCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.handleApprovalDeletion(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, communityName, + communityEndpointName, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalDeletionWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalDeletionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, contentType, + accept, body, Context.NONE); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalDeletionWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalDeletionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, contentType, + accept, body, context); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalActionResponseInner> + beginHandleApprovalDeletionAsync(String resourceGroupName, String communityName, String communityEndpointName, + ApprovalDeletionCallbackRequest body) { + Mono>> mono + = handleApprovalDeletionWithResponseAsync(resourceGroupName, communityName, communityEndpointName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, + this.client.getContext()); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String communityName, String communityEndpointName, + ApprovalDeletionCallbackRequest body) { + Response response + = handleApprovalDeletionWithResponse(resourceGroupName, communityName, communityEndpointName, body); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, Context.NONE); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String communityName, String communityEndpointName, + ApprovalDeletionCallbackRequest body, Context context) { + Response response = handleApprovalDeletionWithResponse(resourceGroupName, communityName, + communityEndpointName, body, context); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, context); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono handleApprovalDeletionAsync(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalDeletionCallbackRequest body) { + return beginHandleApprovalDeletionAsync(resourceGroupName, communityName, communityEndpointName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body) { + return beginHandleApprovalDeletion(resourceGroupName, communityName, communityEndpointName, body) + .getFinalResult(); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + return beginHandleApprovalDeletion(resourceGroupName, communityName, communityEndpointName, body, context) + .getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCommunityResourceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCommunityResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCommunityResourceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByCommunityResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCommunityResourceNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByCommunityResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointsImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointsImpl.java new file mode 100644 index 000000000000..1798f29d543b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointsImpl.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityEndpointResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointResource; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpoints; + +public final class CommunityEndpointsImpl implements CommunityEndpoints { + private static final ClientLogger LOGGER = new ClientLogger(CommunityEndpointsImpl.class); + + private final CommunityEndpointsClient innerClient; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public CommunityEndpointsImpl(CommunityEndpointsClient innerClient, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, communityName, communityEndpointName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CommunityEndpointResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CommunityEndpointResource get(String resourceGroupName, String communityName, String communityEndpointName) { + CommunityEndpointResourceInner inner + = this.serviceClient().get(resourceGroupName, communityName, communityEndpointName); + if (inner != null) { + return new CommunityEndpointResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String communityName, String communityEndpointName) { + this.serviceClient().delete(resourceGroupName, communityName, communityEndpointName); + } + + public void delete(String resourceGroupName, String communityName, String communityEndpointName, Context context) { + this.serviceClient().delete(resourceGroupName, communityName, communityEndpointName, context); + } + + public PagedIterable listByCommunityResource(String resourceGroupName, + String communityName) { + PagedIterable inner + = this.serviceClient().listByCommunityResource(resourceGroupName, communityName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CommunityEndpointResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByCommunityResource(String resourceGroupName, + String communityName, Context context) { + PagedIterable inner + = this.serviceClient().listByCommunityResource(resourceGroupName, communityName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CommunityEndpointResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(String communityName) { + PagedIterable inner = this.serviceClient().listBySubscription(communityName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CommunityEndpointResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(String communityName, Context context) { + PagedIterable inner + = this.serviceClient().listBySubscription(communityName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CommunityEndpointResourceImpl(inner1, this.manager())); + } + + public ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body) { + ApprovalActionResponseInner inner = this.serviceClient() + .handleApprovalCreation(resourceGroupName, communityName, communityEndpointName, body); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body, Context context) { + ApprovalActionResponseInner inner = this.serviceClient() + .handleApprovalCreation(resourceGroupName, communityName, communityEndpointName, body, context); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body) { + ApprovalActionResponseInner inner = this.serviceClient() + .handleApprovalDeletion(resourceGroupName, communityName, communityEndpointName, body); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + ApprovalActionResponseInner inner = this.serviceClient() + .handleApprovalDeletion(resourceGroupName, communityName, communityEndpointName, body, context); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public CommunityEndpointResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + String communityEndpointName = ResourceManagerUtils.getValueFromIdByName(id, "communityEndpoints"); + if (communityEndpointName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communityEndpoints'.", id))); + } + return this.getWithResponse(resourceGroupName, communityName, communityEndpointName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + String communityEndpointName = ResourceManagerUtils.getValueFromIdByName(id, "communityEndpoints"); + if (communityEndpointName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communityEndpoints'.", id))); + } + return this.getWithResponse(resourceGroupName, communityName, communityEndpointName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + String communityEndpointName = ResourceManagerUtils.getValueFromIdByName(id, "communityEndpoints"); + if (communityEndpointName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communityEndpoints'.", id))); + } + this.delete(resourceGroupName, communityName, communityEndpointName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + String communityEndpointName = ResourceManagerUtils.getValueFromIdByName(id, "communityEndpoints"); + if (communityEndpointName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communityEndpoints'.", id))); + } + this.delete(resourceGroupName, communityName, communityEndpointName, context); + } + + private CommunityEndpointsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + public CommunityEndpointResourceImpl define(String name) { + return new CommunityEndpointResourceImpl(name, this.manager()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityResourceImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityResourceImpl.java new file mode 100644 index 000000000000..5507ac642d3c --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityResourceImpl.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityResponse; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityResource; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import java.util.Collections; +import java.util.Map; + +public final class CommunityResourceImpl + implements CommunityResource, CommunityResource.Definition, CommunityResource.Update { + private CommunityResourceInner innerObject; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public CommunityProperties properties() { + return this.innerModel().properties(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CommunityResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String communityName; + + private CommunityPatchModel updateProperties; + + public CommunityResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CommunityResource create() { + this.innerObject = serviceManager.serviceClient() + .getCommunities() + .createOrUpdate(resourceGroupName, communityName, this.innerModel(), Context.NONE); + return this; + } + + public CommunityResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCommunities() + .createOrUpdate(resourceGroupName, communityName, this.innerModel(), context); + return this; + } + + CommunityResourceImpl(String name, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = new CommunityResourceInner(); + this.serviceManager = serviceManager; + this.communityName = name; + } + + public CommunityResourceImpl update() { + this.updateProperties = new CommunityPatchModel(); + return this; + } + + public CommunityResource apply() { + this.innerObject = serviceManager.serviceClient() + .getCommunities() + .update(resourceGroupName, communityName, updateProperties, Context.NONE); + return this; + } + + public CommunityResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCommunities() + .update(resourceGroupName, communityName, updateProperties, context); + return this; + } + + CommunityResourceImpl(CommunityResourceInner innerObject, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.communityName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "communities"); + } + + public CommunityResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getCommunities() + .getByResourceGroupWithResponse(resourceGroupName, communityName, Context.NONE) + .getValue(); + return this; + } + + public CommunityResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCommunities() + .getByResourceGroupWithResponse(resourceGroupName, communityName, context) + .getValue(); + return this; + } + + public Response checkAddressSpaceAvailabilityWithResponse( + CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest, Context context) { + return serviceManager.communities() + .checkAddressSpaceAvailabilityWithResponse(resourceGroupName, communityName, + checkAddressSpaceAvailabilityRequest, context); + } + + public CheckAddressSpaceAvailabilityResponse + checkAddressSpaceAvailability(CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest) { + return serviceManager.communities() + .checkAddressSpaceAvailability(resourceGroupName, communityName, checkAddressSpaceAvailabilityRequest); + } + + public CommunityResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CommunityResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CommunityResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public CommunityResourceImpl withProperties(CommunityProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public CommunityResourceImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + public CommunityResourceImpl withProperties(CommunityPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionResourceImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionResourceImpl.java new file mode 100644 index 000000000000..52aa60049728 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionResourceImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveConnectionResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionResource; +import java.util.Collections; +import java.util.Map; + +public final class EnclaveConnectionResourceImpl + implements EnclaveConnectionResource, EnclaveConnectionResource.Definition, EnclaveConnectionResource.Update { + private EnclaveConnectionResourceInner innerObject; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public EnclaveConnectionProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public EnclaveConnectionResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String enclaveConnectionName; + + private EnclaveConnectionPatchModel updateProperties; + + public EnclaveConnectionResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public EnclaveConnectionResource create() { + this.innerObject = serviceManager.serviceClient() + .getEnclaveConnections() + .createOrUpdate(resourceGroupName, enclaveConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public EnclaveConnectionResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEnclaveConnections() + .createOrUpdate(resourceGroupName, enclaveConnectionName, this.innerModel(), context); + return this; + } + + EnclaveConnectionResourceImpl(String name, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = new EnclaveConnectionResourceInner(); + this.serviceManager = serviceManager; + this.enclaveConnectionName = name; + } + + public EnclaveConnectionResourceImpl update() { + this.updateProperties = new EnclaveConnectionPatchModel(); + return this; + } + + public EnclaveConnectionResource apply() { + this.innerObject = serviceManager.serviceClient() + .getEnclaveConnections() + .update(resourceGroupName, enclaveConnectionName, updateProperties, Context.NONE); + return this; + } + + public EnclaveConnectionResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEnclaveConnections() + .update(resourceGroupName, enclaveConnectionName, updateProperties, context); + return this; + } + + EnclaveConnectionResourceImpl(EnclaveConnectionResourceInner innerObject, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.enclaveConnectionName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "enclaveConnections"); + } + + public EnclaveConnectionResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getEnclaveConnections() + .getByResourceGroupWithResponse(resourceGroupName, enclaveConnectionName, Context.NONE) + .getValue(); + return this; + } + + public EnclaveConnectionResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEnclaveConnections() + .getByResourceGroupWithResponse(resourceGroupName, enclaveConnectionName, context) + .getValue(); + return this; + } + + public ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body) { + return serviceManager.enclaveConnections() + .handleApprovalCreation(resourceGroupName, enclaveConnectionName, body); + } + + public ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body, Context context) { + return serviceManager.enclaveConnections() + .handleApprovalCreation(resourceGroupName, enclaveConnectionName, body, context); + } + + public ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body) { + return serviceManager.enclaveConnections() + .handleApprovalDeletion(resourceGroupName, enclaveConnectionName, body); + } + + public ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body, Context context) { + return serviceManager.enclaveConnections() + .handleApprovalDeletion(resourceGroupName, enclaveConnectionName, body, context); + } + + public EnclaveConnectionResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public EnclaveConnectionResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public EnclaveConnectionResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public EnclaveConnectionResourceImpl withProperties(EnclaveConnectionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public EnclaveConnectionResourceImpl withProperties(EnclaveConnectionPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionsClientImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionsClientImpl.java new file mode 100644 index 000000000000..704d5d8496dc --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionsClientImpl.java @@ -0,0 +1,1535 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveConnectionResourceInner; +import com.azure.resourcemanager.virtualenclaves.implementation.models.EnclaveConnectionResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchModel; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EnclaveConnectionsClient. + */ +public final class EnclaveConnectionsClientImpl implements EnclaveConnectionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final EnclaveConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final VirtualEnclavesManagementClientImpl client; + + /** + * Initializes an instance of EnclaveConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnclaveConnectionsClientImpl(VirtualEnclavesManagementClientImpl client) { + this.service = RestProxy.create(EnclaveConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for VirtualEnclavesManagementClientEnclaveConnections to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VirtualEnclavesManagementClientEnclaveConnections") + public interface EnclaveConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") EnclaveConnectionResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") EnclaveConnectionResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") EnclaveConnectionPatchModel properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") EnclaveConnectionPatchModel properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/enclaveConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/enclaveConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}/handleApprovalCreation") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> handleApprovalCreation(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalCallbackRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}/handleApprovalCreation") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response handleApprovalCreationSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalCallbackRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}/handleApprovalDeletion") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> handleApprovalDeletion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalDeletionCallbackRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}/handleApprovalDeletion") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response handleApprovalDeletionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalDeletionCallbackRequest body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveConnectionResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String enclaveConnectionName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveConnectionResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String enclaveConnectionName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, enclaveConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveConnectionResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String enclaveConnectionName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, accept, context); + } + + /** + * Get a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveConnectionResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveConnectionResourceInner getByResourceGroup(String resourceGroupName, String enclaveConnectionName) { + return getByResourceGroupWithResponse(resourceGroupName, enclaveConnectionName, Context.NONE).getValue(); + } + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, EnclaveConnectionResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, contentType, accept, resource, + context); + } + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnclaveConnectionResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, enclaveConnectionName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), EnclaveConnectionResourceInner.class, EnclaveConnectionResourceInner.class, + this.client.getContext()); + } + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveConnectionResourceInner> beginCreateOrUpdate( + String resourceGroupName, String enclaveConnectionName, EnclaveConnectionResourceInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, enclaveConnectionName, resource); + return this.client.getLroResult(response, + EnclaveConnectionResourceInner.class, EnclaveConnectionResourceInner.class, Context.NONE); + } + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveConnectionResourceInner> beginCreateOrUpdate( + String resourceGroupName, String enclaveConnectionName, EnclaveConnectionResourceInner resource, + Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, enclaveConnectionName, resource, context); + return this.client.getLroResult(response, + EnclaveConnectionResourceInner.class, EnclaveConnectionResourceInner.class, context); + } + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String enclaveConnectionName, EnclaveConnectionResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, enclaveConnectionName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveConnectionResourceInner createOrUpdate(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionResourceInner resource) { + return beginCreateOrUpdate(resourceGroupName, enclaveConnectionName, resource).getFinalResult(); + } + + /** + * Create a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveConnectionResourceInner createOrUpdate(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, enclaveConnectionName, resource, context).getFinalResult(); + } + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, EnclaveConnectionPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, contentType, accept, properties, + Context.NONE); + } + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionPatchModel properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, contentType, accept, properties, + context); + } + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnclaveConnectionResourceInner> beginUpdateAsync( + String resourceGroupName, String enclaveConnectionName, EnclaveConnectionPatchModel properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, enclaveConnectionName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), EnclaveConnectionResourceInner.class, EnclaveConnectionResourceInner.class, + this.client.getContext()); + } + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveConnectionResourceInner> + beginUpdate(String resourceGroupName, String enclaveConnectionName, EnclaveConnectionPatchModel properties) { + Response response = updateWithResponse(resourceGroupName, enclaveConnectionName, properties); + return this.client.getLroResult(response, + EnclaveConnectionResourceInner.class, EnclaveConnectionResourceInner.class, Context.NONE); + } + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveConnectionResourceInner> beginUpdate( + String resourceGroupName, String enclaveConnectionName, EnclaveConnectionPatchModel properties, + Context context) { + Response response + = updateWithResponse(resourceGroupName, enclaveConnectionName, properties, context); + return this.client.getLroResult(response, + EnclaveConnectionResourceInner.class, EnclaveConnectionResourceInner.class, context); + } + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionPatchModel properties) { + return beginUpdateAsync(resourceGroupName, enclaveConnectionName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveConnectionResourceInner update(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionPatchModel properties) { + return beginUpdate(resourceGroupName, enclaveConnectionName, properties).getFinalResult(); + } + + /** + * Update a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveConnectionResourceInner update(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionPatchModel properties, Context context) { + return beginUpdate(resourceGroupName, enclaveConnectionName, properties, context).getFinalResult(); + } + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String enclaveConnectionName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String enclaveConnectionName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, Context.NONE); + } + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String enclaveConnectionName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, context); + } + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String enclaveConnectionName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, enclaveConnectionName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String enclaveConnectionName) { + Response response = deleteWithResponse(resourceGroupName, enclaveConnectionName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String enclaveConnectionName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, enclaveConnectionName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String enclaveConnectionName) { + return beginDeleteAsync(resourceGroupName, enclaveConnectionName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String enclaveConnectionName) { + beginDelete(resourceGroupName, enclaveConnectionName).getFinalResult(); + } + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String enclaveConnectionName, Context context) { + beginDelete(resourceGroupName, enclaveConnectionName, context).getFinalResult(); + } + + /** + * List EnclaveConnectionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List EnclaveConnectionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List EnclaveConnectionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveConnectionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveConnectionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List EnclaveConnectionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, + Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List EnclaveConnectionResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List EnclaveConnectionResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List EnclaveConnectionResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveConnectionResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveConnectionResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List EnclaveConnectionResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> handleApprovalCreationWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.handleApprovalCreation(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, + contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalCreationWithResponse(String resourceGroupName, + String enclaveConnectionName, ApprovalCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalCreationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, contentType, accept, body, + Context.NONE); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalCreationWithResponse(String resourceGroupName, + String enclaveConnectionName, ApprovalCallbackRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalCreationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, contentType, accept, body, + context); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalActionResponseInner> + beginHandleApprovalCreationAsync(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body) { + Mono>> mono + = handleApprovalCreationWithResponseAsync(resourceGroupName, enclaveConnectionName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, + this.client.getContext()); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String enclaveConnectionName, ApprovalCallbackRequest body) { + Response response + = handleApprovalCreationWithResponse(resourceGroupName, enclaveConnectionName, body); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, Context.NONE); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String enclaveConnectionName, ApprovalCallbackRequest body, Context context) { + Response response + = handleApprovalCreationWithResponse(resourceGroupName, enclaveConnectionName, body, context); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, context); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono handleApprovalCreationAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalCallbackRequest body) { + return beginHandleApprovalCreationAsync(resourceGroupName, enclaveConnectionName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body) { + return beginHandleApprovalCreation(resourceGroupName, enclaveConnectionName, body).getFinalResult(); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body, Context context) { + return beginHandleApprovalCreation(resourceGroupName, enclaveConnectionName, body, context).getFinalResult(); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> handleApprovalDeletionWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.handleApprovalDeletion(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, + contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalDeletionWithResponse(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalDeletionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, contentType, accept, body, + Context.NONE); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalDeletionWithResponse(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalDeletionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, contentType, accept, body, + context); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalActionResponseInner> + beginHandleApprovalDeletionAsync(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body) { + Mono>> mono + = handleApprovalDeletionWithResponseAsync(resourceGroupName, enclaveConnectionName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, + this.client.getContext()); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String enclaveConnectionName, ApprovalDeletionCallbackRequest body) { + Response response + = handleApprovalDeletionWithResponse(resourceGroupName, enclaveConnectionName, body); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, Context.NONE); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String enclaveConnectionName, ApprovalDeletionCallbackRequest body, Context context) { + Response response + = handleApprovalDeletionWithResponse(resourceGroupName, enclaveConnectionName, body, context); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, context); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono handleApprovalDeletionAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body) { + return beginHandleApprovalDeletionAsync(resourceGroupName, enclaveConnectionName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body) { + return beginHandleApprovalDeletion(resourceGroupName, enclaveConnectionName, body).getFinalResult(); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body, Context context) { + return beginHandleApprovalDeletion(resourceGroupName, enclaveConnectionName, body, context).getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionsImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionsImpl.java new file mode 100644 index 000000000000..7a7703ce58df --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionsImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveConnectionResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionResource; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnections; + +public final class EnclaveConnectionsImpl implements EnclaveConnections { + private static final ClientLogger LOGGER = new ClientLogger(EnclaveConnectionsImpl.class); + + private final EnclaveConnectionsClient innerClient; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public EnclaveConnectionsImpl(EnclaveConnectionsClient innerClient, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String enclaveConnectionName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, enclaveConnectionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EnclaveConnectionResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EnclaveConnectionResource getByResourceGroup(String resourceGroupName, String enclaveConnectionName) { + EnclaveConnectionResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, enclaveConnectionName); + if (inner != null) { + return new EnclaveConnectionResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String enclaveConnectionName) { + this.serviceClient().delete(resourceGroupName, enclaveConnectionName); + } + + public void delete(String resourceGroupName, String enclaveConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, enclaveConnectionName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveConnectionResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveConnectionResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveConnectionResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveConnectionResourceImpl(inner1, this.manager())); + } + + public ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body) { + ApprovalActionResponseInner inner + = this.serviceClient().handleApprovalCreation(resourceGroupName, enclaveConnectionName, body); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body, Context context) { + ApprovalActionResponseInner inner + = this.serviceClient().handleApprovalCreation(resourceGroupName, enclaveConnectionName, body, context); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body) { + ApprovalActionResponseInner inner + = this.serviceClient().handleApprovalDeletion(resourceGroupName, enclaveConnectionName, body); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body, Context context) { + ApprovalActionResponseInner inner + = this.serviceClient().handleApprovalDeletion(resourceGroupName, enclaveConnectionName, body, context); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public EnclaveConnectionResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String enclaveConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "enclaveConnections"); + if (enclaveConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enclaveConnections'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, enclaveConnectionName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String enclaveConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "enclaveConnections"); + if (enclaveConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enclaveConnections'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, enclaveConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String enclaveConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "enclaveConnections"); + if (enclaveConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enclaveConnections'.", id))); + } + this.delete(resourceGroupName, enclaveConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String enclaveConnectionName = ResourceManagerUtils.getValueFromIdByName(id, "enclaveConnections"); + if (enclaveConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enclaveConnections'.", id))); + } + this.delete(resourceGroupName, enclaveConnectionName, context); + } + + private EnclaveConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + public EnclaveConnectionResourceImpl define(String name) { + return new EnclaveConnectionResourceImpl(name, this.manager()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointResourceImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointResourceImpl.java new file mode 100644 index 000000000000..472845d58ff3 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointResourceImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveEndpointResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointResource; +import java.util.Collections; +import java.util.Map; + +public final class EnclaveEndpointResourceImpl + implements EnclaveEndpointResource, EnclaveEndpointResource.Definition, EnclaveEndpointResource.Update { + private EnclaveEndpointResourceInner innerObject; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public EnclaveEndpointProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public EnclaveEndpointResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualEnclaveName; + + private String enclaveEndpointName; + + private EnclaveEndpointPatchModel updateProperties; + + public EnclaveEndpointResourceImpl withExistingVirtualEnclave(String resourceGroupName, String virtualEnclaveName) { + this.resourceGroupName = resourceGroupName; + this.virtualEnclaveName = virtualEnclaveName; + return this; + } + + public EnclaveEndpointResource create() { + this.innerObject = serviceManager.serviceClient() + .getEnclaveEndpoints() + .createOrUpdate(resourceGroupName, virtualEnclaveName, enclaveEndpointName, this.innerModel(), + Context.NONE); + return this; + } + + public EnclaveEndpointResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEnclaveEndpoints() + .createOrUpdate(resourceGroupName, virtualEnclaveName, enclaveEndpointName, this.innerModel(), context); + return this; + } + + EnclaveEndpointResourceImpl(String name, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = new EnclaveEndpointResourceInner(); + this.serviceManager = serviceManager; + this.enclaveEndpointName = name; + } + + public EnclaveEndpointResourceImpl update() { + this.updateProperties = new EnclaveEndpointPatchModel(); + return this; + } + + public EnclaveEndpointResource apply() { + this.innerObject = serviceManager.serviceClient() + .getEnclaveEndpoints() + .update(resourceGroupName, virtualEnclaveName, enclaveEndpointName, updateProperties, Context.NONE); + return this; + } + + public EnclaveEndpointResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEnclaveEndpoints() + .update(resourceGroupName, virtualEnclaveName, enclaveEndpointName, updateProperties, context); + return this; + } + + EnclaveEndpointResourceImpl(EnclaveEndpointResourceInner innerObject, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "virtualEnclaves"); + this.enclaveEndpointName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "enclaveEndpoints"); + } + + public EnclaveEndpointResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getEnclaveEndpoints() + .getWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, Context.NONE) + .getValue(); + return this; + } + + public EnclaveEndpointResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getEnclaveEndpoints() + .getWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context) + .getValue(); + return this; + } + + public ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body) { + return serviceManager.enclaveEndpoints() + .handleApprovalCreation(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + } + + public ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body, Context context) { + return serviceManager.enclaveEndpoints() + .handleApprovalCreation(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context); + } + + public ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body) { + return serviceManager.enclaveEndpoints() + .handleApprovalDeletion(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + } + + public ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body, Context context) { + return serviceManager.enclaveEndpoints() + .handleApprovalDeletion(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context); + } + + public EnclaveEndpointResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public EnclaveEndpointResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public EnclaveEndpointResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public EnclaveEndpointResourceImpl withProperties(EnclaveEndpointProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public EnclaveEndpointResourceImpl withProperties(EnclaveEndpointPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointsClientImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointsClientImpl.java new file mode 100644 index 000000000000..b61d0cf51267 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointsClientImpl.java @@ -0,0 +1,1648 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveEndpointResourceInner; +import com.azure.resourcemanager.virtualenclaves.implementation.models.EnclaveEndpointResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchModel; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in EnclaveEndpointsClient. + */ +public final class EnclaveEndpointsClientImpl implements EnclaveEndpointsClient { + /** + * The proxy service used to perform REST calls. + */ + private final EnclaveEndpointsService service; + + /** + * The service client containing this operation class. + */ + private final VirtualEnclavesManagementClientImpl client; + + /** + * Initializes an instance of EnclaveEndpointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnclaveEndpointsClientImpl(VirtualEnclavesManagementClientImpl client) { + this.service + = RestProxy.create(EnclaveEndpointsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for VirtualEnclavesManagementClientEnclaveEndpoints to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VirtualEnclavesManagementClientEnclaveEndpoints") + public interface EnclaveEndpointsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") EnclaveEndpointResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") EnclaveEndpointResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") EnclaveEndpointPatchModel properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") EnclaveEndpointPatchModel properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByEnclaveResource(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByEnclaveResourceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Accept") String accept, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}/handleApprovalCreation") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> handleApprovalCreation(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalCallbackRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}/handleApprovalCreation") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response handleApprovalCreationSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalCallbackRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}/handleApprovalDeletion") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> handleApprovalDeletion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalDeletionCallbackRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}/handleApprovalDeletion") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response handleApprovalDeletionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ApprovalDeletionCallbackRequest body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByEnclaveResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByEnclaveResourceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveEndpointResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveEndpointResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName) { + return getWithResponseAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveEndpointResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, virtualEnclaveName, enclaveEndpointName, accept, context); + } + + /** + * Get a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveEndpointResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveEndpointResourceInner get(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName) { + return getWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, Context.NONE).getValue(); + } + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, EnclaveEndpointResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, contentType, + accept, resource, Context.NONE); + } + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, contentType, + accept, resource, context); + } + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnclaveEndpointResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), EnclaveEndpointResourceInner.class, EnclaveEndpointResourceInner.class, + this.client.getContext()); + } + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveEndpointResourceInner> beginCreateOrUpdate( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointResourceInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource); + return this.client.getLroResult(response, + EnclaveEndpointResourceInner.class, EnclaveEndpointResourceInner.class, Context.NONE); + } + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveEndpointResourceInner> beginCreateOrUpdate( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointResourceInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource, context); + return this.client.getLroResult(response, + EnclaveEndpointResourceInner.class, EnclaveEndpointResourceInner.class, context); + } + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveEndpointResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointResourceInner resource) { + return beginCreateOrUpdate(resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource) + .getFinalResult(); + } + + /** + * Create a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveEndpointResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource, context) + .getFinalResult(); + } + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, EnclaveEndpointPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, + contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, contentType, + accept, properties, Context.NONE); + } + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointPatchModel properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, contentType, + accept, properties, context); + } + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnclaveEndpointResourceInner> beginUpdateAsync( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointPatchModel properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), EnclaveEndpointResourceInner.class, EnclaveEndpointResourceInner.class, + this.client.getContext()); + } + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveEndpointResourceInner> beginUpdate( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointPatchModel properties) { + Response response + = updateWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties); + return this.client.getLroResult(response, + EnclaveEndpointResourceInner.class, EnclaveEndpointResourceInner.class, Context.NONE); + } + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveEndpointResourceInner> beginUpdate( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointPatchModel properties, Context context) { + Response response + = updateWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties, context); + return this.client.getLroResult(response, + EnclaveEndpointResourceInner.class, EnclaveEndpointResourceInner.class, context); + } + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointPatchModel properties) { + return beginUpdateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveEndpointResourceInner update(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointPatchModel properties) { + return beginUpdate(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties).getFinalResult(); + } + + /** + * Update a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveEndpointResourceInner update(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointPatchModel properties, Context context) { + return beginUpdate(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties, context) + .getFinalResult(); + } + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, Context.NONE); + } + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, context); + } + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName) { + Response response = deleteWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName) { + return beginDeleteAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName) { + beginDelete(resourceGroupName, virtualEnclaveName, enclaveEndpointName).getFinalResult(); + } + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + Context context) { + beginDelete(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context).getFinalResult(); + } + + /** + * List EnclaveEndpointResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByEnclaveResourceSinglePageAsync(String resourceGroupName, String virtualEnclaveName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByEnclaveResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List EnclaveEndpointResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByEnclaveResourceAsync(String resourceGroupName, + String virtualEnclaveName) { + return new PagedFlux<>(() -> listByEnclaveResourceSinglePageAsync(resourceGroupName, virtualEnclaveName), + nextLink -> listByEnclaveResourceNextSinglePageAsync(nextLink)); + } + + /** + * List EnclaveEndpointResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnclaveResourceSinglePage(String resourceGroupName, + String virtualEnclaveName) { + final String accept = "application/json"; + Response res + = service.listByEnclaveResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveEndpointResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnclaveResourceSinglePage(String resourceGroupName, + String virtualEnclaveName, Context context) { + final String accept = "application/json"; + Response res + = service.listByEnclaveResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveEndpointResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByEnclaveResource(String resourceGroupName, + String virtualEnclaveName) { + return new PagedIterable<>(() -> listByEnclaveResourceSinglePage(resourceGroupName, virtualEnclaveName), + nextLink -> listByEnclaveResourceNextSinglePage(nextLink)); + } + + /** + * List EnclaveEndpointResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByEnclaveResource(String resourceGroupName, + String virtualEnclaveName, Context context) { + return new PagedIterable<>( + () -> listByEnclaveResourceSinglePage(resourceGroupName, virtualEnclaveName, context), + nextLink -> listByEnclaveResourceNextSinglePage(nextLink, context)); + } + + /** + * List EnclaveEndpointResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySubscriptionSinglePageAsync(String virtualEnclaveName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), virtualEnclaveName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List EnclaveEndpointResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String virtualEnclaveName) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(virtualEnclaveName), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List EnclaveEndpointResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(String virtualEnclaveName) { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), virtualEnclaveName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveEndpointResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(String virtualEnclaveName, + Context context) { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), virtualEnclaveName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveEndpointResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String virtualEnclaveName) { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(virtualEnclaveName), + nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List EnclaveEndpointResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String virtualEnclaveName, Context context) { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(virtualEnclaveName, context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> handleApprovalCreationWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.handleApprovalCreation(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, + enclaveEndpointName, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalCreationWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalCreationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, contentType, + accept, body, Context.NONE); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalCreationWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalCreationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, contentType, + accept, body, context); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalActionResponseInner> + beginHandleApprovalCreationAsync(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body) { + Mono>> mono + = handleApprovalCreationWithResponseAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, + this.client.getContext()); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body) { + Response response + = handleApprovalCreationWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, Context.NONE); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body, + Context context) { + Response response = handleApprovalCreationWithResponse(resourceGroupName, virtualEnclaveName, + enclaveEndpointName, body, context); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, context); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono handleApprovalCreationAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body) { + return beginHandleApprovalCreationAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body) { + return beginHandleApprovalCreation(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body) + .getFinalResult(); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body, Context context) { + return beginHandleApprovalCreation(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context) + .getFinalResult(); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> handleApprovalDeletionWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalDeletionCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.handleApprovalDeletion(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, + enclaveEndpointName, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalDeletionWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalDeletionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, contentType, + accept, body, Context.NONE); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalDeletionWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalDeletionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, contentType, + accept, body, context); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalActionResponseInner> + beginHandleApprovalDeletionAsync(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body) { + Mono>> mono + = handleApprovalDeletionWithResponseAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, + this.client.getContext()); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + ApprovalDeletionCallbackRequest body) { + Response response + = handleApprovalDeletionWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, Context.NONE); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + ApprovalDeletionCallbackRequest body, Context context) { + Response response = handleApprovalDeletionWithResponse(resourceGroupName, virtualEnclaveName, + enclaveEndpointName, body, context); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, context); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono handleApprovalDeletionAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalDeletionCallbackRequest body) { + return beginHandleApprovalDeletionAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body) { + return beginHandleApprovalDeletion(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body) + .getFinalResult(); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + return beginHandleApprovalDeletion(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context) + .getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByEnclaveResourceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByEnclaveResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnclaveResourceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByEnclaveResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnclaveResourceNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByEnclaveResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointsImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointsImpl.java new file mode 100644 index 000000000000..c1b2771f2381 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointsImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveEndpointResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointResource; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpoints; + +public final class EnclaveEndpointsImpl implements EnclaveEndpoints { + private static final ClientLogger LOGGER = new ClientLogger(EnclaveEndpointsImpl.class); + + private final EnclaveEndpointsClient innerClient; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public EnclaveEndpointsImpl(EnclaveEndpointsClient innerClient, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EnclaveEndpointResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EnclaveEndpointResource get(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName) { + EnclaveEndpointResourceInner inner + = this.serviceClient().get(resourceGroupName, virtualEnclaveName, enclaveEndpointName); + if (inner != null) { + return new EnclaveEndpointResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName) { + this.serviceClient().delete(resourceGroupName, virtualEnclaveName, enclaveEndpointName); + } + + public void delete(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + Context context) { + this.serviceClient().delete(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context); + } + + public PagedIterable listByEnclaveResource(String resourceGroupName, + String virtualEnclaveName) { + PagedIterable inner + = this.serviceClient().listByEnclaveResource(resourceGroupName, virtualEnclaveName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveEndpointResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByEnclaveResource(String resourceGroupName, + String virtualEnclaveName, Context context) { + PagedIterable inner + = this.serviceClient().listByEnclaveResource(resourceGroupName, virtualEnclaveName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveEndpointResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(String virtualEnclaveName) { + PagedIterable inner = this.serviceClient().listBySubscription(virtualEnclaveName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveEndpointResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(String virtualEnclaveName, Context context) { + PagedIterable inner + = this.serviceClient().listBySubscription(virtualEnclaveName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveEndpointResourceImpl(inner1, this.manager())); + } + + public ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body) { + ApprovalActionResponseInner inner = this.serviceClient() + .handleApprovalCreation(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body, Context context) { + ApprovalActionResponseInner inner = this.serviceClient() + .handleApprovalCreation(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body) { + ApprovalActionResponseInner inner = this.serviceClient() + .handleApprovalDeletion(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + ApprovalActionResponseInner inner = this.serviceClient() + .handleApprovalDeletion(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public EnclaveEndpointResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + String enclaveEndpointName = ResourceManagerUtils.getValueFromIdByName(id, "enclaveEndpoints"); + if (enclaveEndpointName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enclaveEndpoints'.", id))); + } + return this.getWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + String enclaveEndpointName = ResourceManagerUtils.getValueFromIdByName(id, "enclaveEndpoints"); + if (enclaveEndpointName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enclaveEndpoints'.", id))); + } + return this.getWithResponse(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + String enclaveEndpointName = ResourceManagerUtils.getValueFromIdByName(id, "enclaveEndpoints"); + if (enclaveEndpointName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enclaveEndpoints'.", id))); + } + this.delete(resourceGroupName, virtualEnclaveName, enclaveEndpointName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + String enclaveEndpointName = ResourceManagerUtils.getValueFromIdByName(id, "enclaveEndpoints"); + if (enclaveEndpointName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'enclaveEndpoints'.", id))); + } + this.delete(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context); + } + + private EnclaveEndpointsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + public EnclaveEndpointResourceImpl define(String name) { + return new EnclaveEndpointResourceImpl(name, this.manager()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveResourceImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveResourceImpl.java new file mode 100644 index 000000000000..95272c3571d1 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveResourceImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveResource; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchModel; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclaveProperties; +import java.util.Collections; +import java.util.Map; + +public final class EnclaveResourceImpl implements EnclaveResource, EnclaveResource.Definition, EnclaveResource.Update { + private EnclaveResourceInner innerObject; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public VirtualEnclaveProperties properties() { + return this.innerModel().properties(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public EnclaveResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualEnclaveName; + + private VirtualEnclavePatchModel updateProperties; + + public EnclaveResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public EnclaveResource create() { + this.innerObject = serviceManager.serviceClient() + .getVirtualEnclaves() + .createOrUpdate(resourceGroupName, virtualEnclaveName, this.innerModel(), Context.NONE); + return this; + } + + public EnclaveResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVirtualEnclaves() + .createOrUpdate(resourceGroupName, virtualEnclaveName, this.innerModel(), context); + return this; + } + + EnclaveResourceImpl(String name, com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = new EnclaveResourceInner(); + this.serviceManager = serviceManager; + this.virtualEnclaveName = name; + } + + public EnclaveResourceImpl update() { + this.updateProperties = new VirtualEnclavePatchModel(); + return this; + } + + public EnclaveResource apply() { + this.innerObject = serviceManager.serviceClient() + .getVirtualEnclaves() + .update(resourceGroupName, virtualEnclaveName, updateProperties, Context.NONE); + return this; + } + + public EnclaveResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVirtualEnclaves() + .update(resourceGroupName, virtualEnclaveName, updateProperties, context); + return this; + } + + EnclaveResourceImpl(EnclaveResourceInner innerObject, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "virtualEnclaves"); + } + + public EnclaveResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getVirtualEnclaves() + .getByResourceGroupWithResponse(resourceGroupName, virtualEnclaveName, Context.NONE) + .getValue(); + return this; + } + + public EnclaveResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVirtualEnclaves() + .getByResourceGroupWithResponse(resourceGroupName, virtualEnclaveName, context) + .getValue(); + return this; + } + + public ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body) { + return serviceManager.virtualEnclaves().handleApprovalCreation(resourceGroupName, virtualEnclaveName, body); + } + + public ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body, Context context) { + return serviceManager.virtualEnclaves() + .handleApprovalCreation(resourceGroupName, virtualEnclaveName, body, context); + } + + public ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body) { + return serviceManager.virtualEnclaves().handleApprovalDeletion(resourceGroupName, virtualEnclaveName, body); + } + + public ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body, Context context) { + return serviceManager.virtualEnclaves() + .handleApprovalDeletion(resourceGroupName, virtualEnclaveName, body, context); + } + + public EnclaveResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public EnclaveResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public EnclaveResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public EnclaveResourceImpl withProperties(VirtualEnclaveProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public EnclaveResourceImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + public EnclaveResourceImpl withProperties(VirtualEnclavePatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationImpl.java new file mode 100644 index 000000000000..724531d89359 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.resourcemanager.virtualenclaves.fluent.models.OperationInner; +import com.azure.resourcemanager.virtualenclaves.models.ActionType; +import com.azure.resourcemanager.virtualenclaves.models.Operation; +import com.azure.resourcemanager.virtualenclaves.models.OperationDisplay; +import com.azure.resourcemanager.virtualenclaves.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationsClientImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..78d8d19b7998 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.virtualenclaves.fluent.OperationsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.OperationInner; +import com.azure.resourcemanager.virtualenclaves.implementation.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final VirtualEnclavesManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(VirtualEnclavesManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for VirtualEnclavesManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VirtualEnclavesManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Mission/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Mission/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationsImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b25664e14e18 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.virtualenclaves.fluent.OperationsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.OperationInner; +import com.azure.resourcemanager.virtualenclaves.models.Operation; +import com.azure.resourcemanager.virtualenclaves.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ResourceManagerUtils.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..67c0d29d671b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubResourceImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubResourceImpl.java new file mode 100644 index 000000000000..66bd3a8483f0 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubResourceImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.TransitHubResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubProperties; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubResource; +import java.util.Collections; +import java.util.Map; + +public final class TransitHubResourceImpl + implements TransitHubResource, TransitHubResource.Definition, TransitHubResource.Update { + private TransitHubResourceInner innerObject; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public TransitHubProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public TransitHubResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String communityName; + + private String transitHubName; + + private TransitHubPatchModel updateProperties; + + public TransitHubResourceImpl withExistingCommunity(String resourceGroupName, String communityName) { + this.resourceGroupName = resourceGroupName; + this.communityName = communityName; + return this; + } + + public TransitHubResource create() { + this.innerObject = serviceManager.serviceClient() + .getTransitHubs() + .createOrUpdate(resourceGroupName, communityName, transitHubName, this.innerModel(), Context.NONE); + return this; + } + + public TransitHubResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTransitHubs() + .createOrUpdate(resourceGroupName, communityName, transitHubName, this.innerModel(), context); + return this; + } + + TransitHubResourceImpl(String name, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = new TransitHubResourceInner(); + this.serviceManager = serviceManager; + this.transitHubName = name; + } + + public TransitHubResourceImpl update() { + this.updateProperties = new TransitHubPatchModel(); + return this; + } + + public TransitHubResource apply() { + this.innerObject = serviceManager.serviceClient() + .getTransitHubs() + .update(resourceGroupName, communityName, transitHubName, updateProperties, Context.NONE); + return this; + } + + public TransitHubResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTransitHubs() + .update(resourceGroupName, communityName, transitHubName, updateProperties, context); + return this; + } + + TransitHubResourceImpl(TransitHubResourceInner innerObject, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.communityName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "communities"); + this.transitHubName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "transitHubs"); + } + + public TransitHubResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getTransitHubs() + .getWithResponse(resourceGroupName, communityName, transitHubName, Context.NONE) + .getValue(); + return this; + } + + public TransitHubResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTransitHubs() + .getWithResponse(resourceGroupName, communityName, transitHubName, context) + .getValue(); + return this; + } + + public TransitHubResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public TransitHubResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public TransitHubResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public TransitHubResourceImpl withProperties(TransitHubProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public TransitHubResourceImpl withProperties(TransitHubPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubsClientImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubsClientImpl.java new file mode 100644 index 000000000000..dd4c49717985 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubsClientImpl.java @@ -0,0 +1,1178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.TransitHubResourceInner; +import com.azure.resourcemanager.virtualenclaves.implementation.models.TransitHubResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchModel; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in TransitHubsClient. + */ +public final class TransitHubsClientImpl implements TransitHubsClient { + /** + * The proxy service used to perform REST calls. + */ + private final TransitHubsService service; + + /** + * The service client containing this operation class. + */ + private final VirtualEnclavesManagementClientImpl client; + + /** + * Initializes an instance of TransitHubsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TransitHubsClientImpl(VirtualEnclavesManagementClientImpl client) { + this.service + = RestProxy.create(TransitHubsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for VirtualEnclavesManagementClientTransitHubs to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VirtualEnclavesManagementClientTransitHubs") + public interface TransitHubsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs/{transitHubName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("transitHubName") String transitHubName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs/{transitHubName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("transitHubName") String transitHubName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs/{transitHubName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("transitHubName") String transitHubName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") TransitHubResourceInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs/{transitHubName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("transitHubName") String transitHubName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") TransitHubResourceInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs/{transitHubName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("transitHubName") String transitHubName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") TransitHubPatchModel properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs/{transitHubName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("transitHubName") String transitHubName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") TransitHubPatchModel properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs/{transitHubName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("transitHubName") String transitHubName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs/{transitHubName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("transitHubName") String transitHubName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCommunityResource(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCommunityResourceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/communities/{communityName}/transitHubs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("communityName") String communityName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/communities/{communityName}/transitHubs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("communityName") String communityName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCommunityResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCommunityResourceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TransitHubResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String communityName, + String transitHubName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TransitHubResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String communityName, + String transitHubName) { + return getWithResponseAsync(resourceGroupName, communityName, transitHubName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TransitHubResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String communityName, + String transitHubName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communityName, transitHubName, accept, context); + } + + /** + * Get a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TransitHubResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransitHubResourceInner get(String resourceGroupName, String communityName, String transitHubName) { + return getWithResponse(resourceGroupName, communityName, transitHubName, Context.NONE).getValue(); + } + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String communityName, String transitHubName, TransitHubResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String communityName, + String transitHubName, TransitHubResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, contentType, accept, + resource, Context.NONE); + } + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String communityName, + String transitHubName, TransitHubResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, contentType, accept, + resource, context); + } + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TransitHubResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String communityName, String transitHubName, TransitHubResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, communityName, transitHubName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), TransitHubResourceInner.class, TransitHubResourceInner.class, + this.client.getContext()); + } + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TransitHubResourceInner> beginCreateOrUpdate( + String resourceGroupName, String communityName, String transitHubName, TransitHubResourceInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, communityName, transitHubName, resource); + return this.client.getLroResult(response, + TransitHubResourceInner.class, TransitHubResourceInner.class, Context.NONE); + } + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TransitHubResourceInner> beginCreateOrUpdate( + String resourceGroupName, String communityName, String transitHubName, TransitHubResourceInner resource, + Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, communityName, transitHubName, resource, context); + return this.client.getLroResult(response, + TransitHubResourceInner.class, TransitHubResourceInner.class, context); + } + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String communityName, + String transitHubName, TransitHubResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, communityName, transitHubName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransitHubResourceInner createOrUpdate(String resourceGroupName, String communityName, String transitHubName, + TransitHubResourceInner resource) { + return beginCreateOrUpdate(resourceGroupName, communityName, transitHubName, resource).getFinalResult(); + } + + /** + * Create a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransitHubResourceInner createOrUpdate(String resourceGroupName, String communityName, String transitHubName, + TransitHubResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, communityName, transitHubName, resource, context) + .getFinalResult(); + } + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String communityName, + String transitHubName, TransitHubPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String communityName, + String transitHubName, TransitHubPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, contentType, accept, + properties, Context.NONE); + } + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String communityName, + String transitHubName, TransitHubPatchModel properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, contentType, accept, + properties, context); + } + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TransitHubResourceInner> beginUpdateAsync( + String resourceGroupName, String communityName, String transitHubName, TransitHubPatchModel properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, communityName, transitHubName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), TransitHubResourceInner.class, TransitHubResourceInner.class, + this.client.getContext()); + } + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TransitHubResourceInner> beginUpdate( + String resourceGroupName, String communityName, String transitHubName, TransitHubPatchModel properties) { + Response response + = updateWithResponse(resourceGroupName, communityName, transitHubName, properties); + return this.client.getLroResult(response, + TransitHubResourceInner.class, TransitHubResourceInner.class, Context.NONE); + } + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TransitHubResourceInner> beginUpdate( + String resourceGroupName, String communityName, String transitHubName, TransitHubPatchModel properties, + Context context) { + Response response + = updateWithResponse(resourceGroupName, communityName, transitHubName, properties, context); + return this.client.getLroResult(response, + TransitHubResourceInner.class, TransitHubResourceInner.class, context); + } + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String communityName, + String transitHubName, TransitHubPatchModel properties) { + return beginUpdateAsync(resourceGroupName, communityName, transitHubName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransitHubResourceInner update(String resourceGroupName, String communityName, String transitHubName, + TransitHubPatchModel properties) { + return beginUpdate(resourceGroupName, communityName, transitHubName, properties).getFinalResult(); + } + + /** + * Update a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransitHubResourceInner update(String resourceGroupName, String communityName, String transitHubName, + TransitHubPatchModel properties, Context context) { + return beginUpdate(resourceGroupName, communityName, transitHubName, properties, context).getFinalResult(); + } + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String communityName, + String transitHubName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String communityName, + String transitHubName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, Context.NONE); + } + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String communityName, + String transitHubName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, context); + } + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String communityName, + String transitHubName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, communityName, transitHubName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String communityName, + String transitHubName) { + Response response = deleteWithResponse(resourceGroupName, communityName, transitHubName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String communityName, + String transitHubName, Context context) { + Response response = deleteWithResponse(resourceGroupName, communityName, transitHubName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communityName, String transitHubName) { + return beginDeleteAsync(resourceGroupName, communityName, transitHubName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String communityName, String transitHubName) { + beginDelete(resourceGroupName, communityName, transitHubName).getFinalResult(); + } + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String communityName, String transitHubName, Context context) { + beginDelete(resourceGroupName, communityName, transitHubName, context).getFinalResult(); + } + + /** + * List TransitHubResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCommunityResourceSinglePageAsync(String resourceGroupName, String communityName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCommunityResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List TransitHubResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCommunityResourceAsync(String resourceGroupName, + String communityName) { + return new PagedFlux<>(() -> listByCommunityResourceSinglePageAsync(resourceGroupName, communityName), + nextLink -> listByCommunityResourceNextSinglePageAsync(nextLink)); + } + + /** + * List TransitHubResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCommunityResourceSinglePage(String resourceGroupName, + String communityName) { + final String accept = "application/json"; + Response res + = service.listByCommunityResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TransitHubResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCommunityResourceSinglePage(String resourceGroupName, + String communityName, Context context) { + final String accept = "application/json"; + Response res + = service.listByCommunityResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TransitHubResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCommunityResource(String resourceGroupName, + String communityName) { + return new PagedIterable<>(() -> listByCommunityResourceSinglePage(resourceGroupName, communityName), + nextLink -> listByCommunityResourceNextSinglePage(nextLink)); + } + + /** + * List TransitHubResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCommunityResource(String resourceGroupName, + String communityName, Context context) { + return new PagedIterable<>(() -> listByCommunityResourceSinglePage(resourceGroupName, communityName, context), + nextLink -> listByCommunityResourceNextSinglePage(nextLink, context)); + } + + /** + * List TransitHubResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(String communityName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), communityName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List TransitHubResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String communityName) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(communityName), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List TransitHubResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(String communityName) { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), communityName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TransitHubResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(String communityName, Context context) { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), communityName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List TransitHubResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String communityName) { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(communityName), + nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List TransitHubResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String communityName, Context context) { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(communityName, context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCommunityResourceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCommunityResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCommunityResourceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByCommunityResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCommunityResourceNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByCommunityResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubsImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubsImpl.java new file mode 100644 index 000000000000..f3472afbbbef --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubsImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.TransitHubResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubResource; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubs; + +public final class TransitHubsImpl implements TransitHubs { + private static final ClientLogger LOGGER = new ClientLogger(TransitHubsImpl.class); + + private final TransitHubsClient innerClient; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public TransitHubsImpl(TransitHubsClient innerClient, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String communityName, + String transitHubName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, communityName, transitHubName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TransitHubResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TransitHubResource get(String resourceGroupName, String communityName, String transitHubName) { + TransitHubResourceInner inner = this.serviceClient().get(resourceGroupName, communityName, transitHubName); + if (inner != null) { + return new TransitHubResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String communityName, String transitHubName) { + this.serviceClient().delete(resourceGroupName, communityName, transitHubName); + } + + public void delete(String resourceGroupName, String communityName, String transitHubName, Context context) { + this.serviceClient().delete(resourceGroupName, communityName, transitHubName, context); + } + + public PagedIterable listByCommunityResource(String resourceGroupName, String communityName) { + PagedIterable inner + = this.serviceClient().listByCommunityResource(resourceGroupName, communityName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TransitHubResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByCommunityResource(String resourceGroupName, String communityName, + Context context) { + PagedIterable inner + = this.serviceClient().listByCommunityResource(resourceGroupName, communityName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TransitHubResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(String communityName) { + PagedIterable inner = this.serviceClient().listBySubscription(communityName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TransitHubResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(String communityName, Context context) { + PagedIterable inner = this.serviceClient().listBySubscription(communityName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TransitHubResourceImpl(inner1, this.manager())); + } + + public TransitHubResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + String transitHubName = ResourceManagerUtils.getValueFromIdByName(id, "transitHubs"); + if (transitHubName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'transitHubs'.", id))); + } + return this.getWithResponse(resourceGroupName, communityName, transitHubName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + String transitHubName = ResourceManagerUtils.getValueFromIdByName(id, "transitHubs"); + if (transitHubName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'transitHubs'.", id))); + } + return this.getWithResponse(resourceGroupName, communityName, transitHubName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + String transitHubName = ResourceManagerUtils.getValueFromIdByName(id, "transitHubs"); + if (transitHubName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'transitHubs'.", id))); + } + this.delete(resourceGroupName, communityName, transitHubName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String communityName = ResourceManagerUtils.getValueFromIdByName(id, "communities"); + if (communityName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'communities'.", id))); + } + String transitHubName = ResourceManagerUtils.getValueFromIdByName(id, "transitHubs"); + if (transitHubName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'transitHubs'.", id))); + } + this.delete(resourceGroupName, communityName, transitHubName, context); + } + + private TransitHubsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + public TransitHubResourceImpl define(String name) { + return new TransitHubResourceImpl(name, this.manager()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesClientImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesClientImpl.java new file mode 100644 index 000000000000..7897456ce8fe --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesClientImpl.java @@ -0,0 +1,1514 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveResourceInner; +import com.azure.resourcemanager.virtualenclaves.implementation.models.EnclaveResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchModel; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in VirtualEnclavesClient. + */ +public final class VirtualEnclavesClientImpl implements VirtualEnclavesClient { + /** + * The proxy service used to perform REST calls. + */ + private final VirtualEnclavesService service; + + /** + * The service client containing this operation class. + */ + private final VirtualEnclavesManagementClientImpl client; + + /** + * Initializes an instance of VirtualEnclavesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualEnclavesClientImpl(VirtualEnclavesManagementClientImpl client) { + this.service + = RestProxy.create(VirtualEnclavesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for VirtualEnclavesManagementClientVirtualEnclaves to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VirtualEnclavesManagementClientVirtualEnclaves") + public interface VirtualEnclavesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") EnclaveResourceInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") EnclaveResourceInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") VirtualEnclavePatchModel properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") VirtualEnclavePatchModel properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/virtualEnclaves") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/virtualEnclaves") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/handleApprovalCreation") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> handleApprovalCreation(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApprovalCallbackRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/handleApprovalCreation") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response handleApprovalCreationSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApprovalCallbackRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/handleApprovalDeletion") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> handleApprovalDeletion(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApprovalDeletionCallbackRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/handleApprovalDeletion") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response handleApprovalDeletionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ApprovalDeletionCallbackRequest body, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String virtualEnclaveName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String virtualEnclaveName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualEnclaveName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String virtualEnclaveName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, accept, context); + } + + /** + * Get a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveResourceInner getByResourceGroup(String resourceGroupName, String virtualEnclaveName) { + return getByResourceGroupWithResponse(resourceGroupName, virtualEnclaveName, Context.NONE).getValue(); + } + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, EnclaveResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String virtualEnclaveName, + EnclaveResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String virtualEnclaveName, + EnclaveResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, contentType, accept, resource, + context); + } + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnclaveResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String virtualEnclaveName, EnclaveResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, virtualEnclaveName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + EnclaveResourceInner.class, EnclaveResourceInner.class, this.client.getContext()); + } + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveResourceInner> + beginCreateOrUpdate(String resourceGroupName, String virtualEnclaveName, EnclaveResourceInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, virtualEnclaveName, resource); + return this.client.getLroResult(response, + EnclaveResourceInner.class, EnclaveResourceInner.class, Context.NONE); + } + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveResourceInner> beginCreateOrUpdate( + String resourceGroupName, String virtualEnclaveName, EnclaveResourceInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, virtualEnclaveName, resource, context); + return this.client.getLroResult(response, + EnclaveResourceInner.class, EnclaveResourceInner.class, context); + } + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String virtualEnclaveName, + EnclaveResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, + EnclaveResourceInner resource) { + return beginCreateOrUpdate(resourceGroupName, virtualEnclaveName, resource).getFinalResult(); + } + + /** + * Create a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, + EnclaveResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, virtualEnclaveName, resource, context).getFinalResult(); + } + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, VirtualEnclavePatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String virtualEnclaveName, + VirtualEnclavePatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, contentType, accept, properties, + Context.NONE); + } + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String virtualEnclaveName, + VirtualEnclavePatchModel properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, contentType, accept, properties, + context); + } + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnclaveResourceInner> + beginUpdateAsync(String resourceGroupName, String virtualEnclaveName, VirtualEnclavePatchModel properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, virtualEnclaveName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + EnclaveResourceInner.class, EnclaveResourceInner.class, this.client.getContext()); + } + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveResourceInner> beginUpdate(String resourceGroupName, + String virtualEnclaveName, VirtualEnclavePatchModel properties) { + Response response = updateWithResponse(resourceGroupName, virtualEnclaveName, properties); + return this.client.getLroResult(response, + EnclaveResourceInner.class, EnclaveResourceInner.class, Context.NONE); + } + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveResourceInner> beginUpdate(String resourceGroupName, + String virtualEnclaveName, VirtualEnclavePatchModel properties, Context context) { + Response response = updateWithResponse(resourceGroupName, virtualEnclaveName, properties, context); + return this.client.getLroResult(response, + EnclaveResourceInner.class, EnclaveResourceInner.class, context); + } + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String virtualEnclaveName, + VirtualEnclavePatchModel properties) { + return beginUpdateAsync(resourceGroupName, virtualEnclaveName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveResourceInner update(String resourceGroupName, String virtualEnclaveName, + VirtualEnclavePatchModel properties) { + return beginUpdate(resourceGroupName, virtualEnclaveName, properties).getFinalResult(); + } + + /** + * Update a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public EnclaveResourceInner update(String resourceGroupName, String virtualEnclaveName, + VirtualEnclavePatchModel properties, Context context) { + return beginUpdate(resourceGroupName, virtualEnclaveName, properties, context).getFinalResult(); + } + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String virtualEnclaveName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String virtualEnclaveName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, Context.NONE); + } + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String virtualEnclaveName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, context); + } + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String virtualEnclaveName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, virtualEnclaveName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName) { + Response response = deleteWithResponse(resourceGroupName, virtualEnclaveName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, virtualEnclaveName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String virtualEnclaveName) { + return beginDeleteAsync(resourceGroupName, virtualEnclaveName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String virtualEnclaveName) { + beginDelete(resourceGroupName, virtualEnclaveName).getFinalResult(); + } + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String virtualEnclaveName, Context context) { + beginDelete(resourceGroupName, virtualEnclaveName, context).getFinalResult(); + } + + /** + * List EnclaveResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List EnclaveResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List EnclaveResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List EnclaveResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List EnclaveResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List EnclaveResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List EnclaveResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List EnclaveResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List EnclaveResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> handleApprovalCreationWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.handleApprovalCreation(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, + contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalCreationWithResponse(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalCreationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, contentType, accept, body, + Context.NONE); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalCreationWithResponse(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalCreationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, contentType, accept, body, context); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalActionResponseInner> + beginHandleApprovalCreationAsync(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body) { + Mono>> mono + = handleApprovalCreationWithResponseAsync(resourceGroupName, virtualEnclaveName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, + this.client.getContext()); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> + beginHandleApprovalCreation(String resourceGroupName, String virtualEnclaveName, ApprovalCallbackRequest body) { + Response response = handleApprovalCreationWithResponse(resourceGroupName, virtualEnclaveName, body); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, Context.NONE); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalCreation( + String resourceGroupName, String virtualEnclaveName, ApprovalCallbackRequest body, Context context) { + Response response + = handleApprovalCreationWithResponse(resourceGroupName, virtualEnclaveName, body, context); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, context); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono handleApprovalCreationAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalCallbackRequest body) { + return beginHandleApprovalCreationAsync(resourceGroupName, virtualEnclaveName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body) { + return beginHandleApprovalCreation(resourceGroupName, virtualEnclaveName, body).getFinalResult(); + } + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body, Context context) { + return beginHandleApprovalCreation(resourceGroupName, virtualEnclaveName, body, context).getFinalResult(); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> handleApprovalDeletionWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalDeletionCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.handleApprovalDeletion(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, + contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalDeletionWithResponse(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalDeletionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, contentType, accept, body, + Context.NONE); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response handleApprovalDeletionWithResponse(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.handleApprovalDeletionSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, contentType, accept, body, context); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalActionResponseInner> + beginHandleApprovalDeletionAsync(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body) { + Mono>> mono + = handleApprovalDeletionWithResponseAsync(resourceGroupName, virtualEnclaveName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, + this.client.getContext()); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String virtualEnclaveName, ApprovalDeletionCallbackRequest body) { + Response response = handleApprovalDeletionWithResponse(resourceGroupName, virtualEnclaveName, body); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, Context.NONE); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalActionResponseInner> beginHandleApprovalDeletion( + String resourceGroupName, String virtualEnclaveName, ApprovalDeletionCallbackRequest body, Context context) { + Response response + = handleApprovalDeletionWithResponse(resourceGroupName, virtualEnclaveName, body, context); + return this.client.getLroResult(response, + ApprovalActionResponseInner.class, ApprovalActionResponseInner.class, context); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono handleApprovalDeletionAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalDeletionCallbackRequest body) { + return beginHandleApprovalDeletionAsync(resourceGroupName, virtualEnclaveName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body) { + return beginHandleApprovalDeletion(resourceGroupName, virtualEnclaveName, body).getFinalResult(); + } + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalActionResponseInner handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body, Context context) { + return beginHandleApprovalDeletion(resourceGroupName, virtualEnclaveName, body, context).getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesImpl.java new file mode 100644 index 000000000000..c953f200eae7 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesImpl.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveResource; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclaves; + +public final class VirtualEnclavesImpl implements VirtualEnclaves { + private static final ClientLogger LOGGER = new ClientLogger(VirtualEnclavesImpl.class); + + private final VirtualEnclavesClient innerClient; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public VirtualEnclavesImpl(VirtualEnclavesClient innerClient, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String virtualEnclaveName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, virtualEnclaveName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new EnclaveResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public EnclaveResource getByResourceGroup(String resourceGroupName, String virtualEnclaveName) { + EnclaveResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, virtualEnclaveName); + if (inner != null) { + return new EnclaveResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String virtualEnclaveName) { + this.serviceClient().delete(resourceGroupName, virtualEnclaveName); + } + + public void delete(String resourceGroupName, String virtualEnclaveName, Context context) { + this.serviceClient().delete(resourceGroupName, virtualEnclaveName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new EnclaveResourceImpl(inner1, this.manager())); + } + + public ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body) { + ApprovalActionResponseInner inner + = this.serviceClient().handleApprovalCreation(resourceGroupName, virtualEnclaveName, body); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body, Context context) { + ApprovalActionResponseInner inner + = this.serviceClient().handleApprovalCreation(resourceGroupName, virtualEnclaveName, body, context); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body) { + ApprovalActionResponseInner inner + = this.serviceClient().handleApprovalDeletion(resourceGroupName, virtualEnclaveName, body); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body, Context context) { + ApprovalActionResponseInner inner + = this.serviceClient().handleApprovalDeletion(resourceGroupName, virtualEnclaveName, body, context); + if (inner != null) { + return new ApprovalActionResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public EnclaveResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, virtualEnclaveName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, virtualEnclaveName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + this.delete(resourceGroupName, virtualEnclaveName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + this.delete(resourceGroupName, virtualEnclaveName, context); + } + + private VirtualEnclavesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + public EnclaveResourceImpl define(String name) { + return new EnclaveResourceImpl(name, this.manager()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesManagementClientBuilder.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesManagementClientBuilder.java new file mode 100644 index 000000000000..b77936c0eab4 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesManagementClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the VirtualEnclavesManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { VirtualEnclavesManagementClientImpl.class }) +public final class VirtualEnclavesManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the VirtualEnclavesManagementClientBuilder. + */ + public VirtualEnclavesManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the VirtualEnclavesManagementClientBuilder. + */ + public VirtualEnclavesManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the VirtualEnclavesManagementClientBuilder. + */ + public VirtualEnclavesManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the VirtualEnclavesManagementClientBuilder. + */ + public VirtualEnclavesManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the VirtualEnclavesManagementClientBuilder. + */ + public VirtualEnclavesManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the VirtualEnclavesManagementClientBuilder. + */ + public VirtualEnclavesManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of VirtualEnclavesManagementClientImpl with the provided parameters. + * + * @return an instance of VirtualEnclavesManagementClientImpl. + */ + public VirtualEnclavesManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + VirtualEnclavesManagementClientImpl client = new VirtualEnclavesManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesManagementClientImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesManagementClientImpl.java new file mode 100644 index 000000000000..baa60d511787 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesManagementClientImpl.java @@ -0,0 +1,436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient; +import com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.OperationsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient; +import com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesManagementClient; +import com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the VirtualEnclavesManagementClientImpl type. + */ +@ServiceClient(builder = VirtualEnclavesManagementClientBuilder.class) +public final class VirtualEnclavesManagementClientImpl implements VirtualEnclavesManagementClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The WorkloadsClient object to access its operations. + */ + private final WorkloadsClient workloads; + + /** + * Gets the WorkloadsClient object to access its operations. + * + * @return the WorkloadsClient object. + */ + public WorkloadsClient getWorkloads() { + return this.workloads; + } + + /** + * The VirtualEnclavesClient object to access its operations. + */ + private final VirtualEnclavesClient virtualEnclaves; + + /** + * Gets the VirtualEnclavesClient object to access its operations. + * + * @return the VirtualEnclavesClient object. + */ + public VirtualEnclavesClient getVirtualEnclaves() { + return this.virtualEnclaves; + } + + /** + * The CommunitiesClient object to access its operations. + */ + private final CommunitiesClient communities; + + /** + * Gets the CommunitiesClient object to access its operations. + * + * @return the CommunitiesClient object. + */ + public CommunitiesClient getCommunities() { + return this.communities; + } + + /** + * The TransitHubsClient object to access its operations. + */ + private final TransitHubsClient transitHubs; + + /** + * Gets the TransitHubsClient object to access its operations. + * + * @return the TransitHubsClient object. + */ + public TransitHubsClient getTransitHubs() { + return this.transitHubs; + } + + /** + * The EnclaveConnectionsClient object to access its operations. + */ + private final EnclaveConnectionsClient enclaveConnections; + + /** + * Gets the EnclaveConnectionsClient object to access its operations. + * + * @return the EnclaveConnectionsClient object. + */ + public EnclaveConnectionsClient getEnclaveConnections() { + return this.enclaveConnections; + } + + /** + * The EnclaveEndpointsClient object to access its operations. + */ + private final EnclaveEndpointsClient enclaveEndpoints; + + /** + * Gets the EnclaveEndpointsClient object to access its operations. + * + * @return the EnclaveEndpointsClient object. + */ + public EnclaveEndpointsClient getEnclaveEndpoints() { + return this.enclaveEndpoints; + } + + /** + * The CommunityEndpointsClient object to access its operations. + */ + private final CommunityEndpointsClient communityEndpoints; + + /** + * Gets the CommunityEndpointsClient object to access its operations. + * + * @return the CommunityEndpointsClient object. + */ + public CommunityEndpointsClient getCommunityEndpoints() { + return this.communityEndpoints; + } + + /** + * The ApprovalsClient object to access its operations. + */ + private final ApprovalsClient approvals; + + /** + * Gets the ApprovalsClient object to access its operations. + * + * @return the ApprovalsClient object. + */ + public ApprovalsClient getApprovals() { + return this.approvals; + } + + /** + * Initializes an instance of VirtualEnclavesManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + VirtualEnclavesManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2025-05-01-preview"; + this.operations = new OperationsClientImpl(this); + this.workloads = new WorkloadsClientImpl(this); + this.virtualEnclaves = new VirtualEnclavesClientImpl(this); + this.communities = new CommunitiesClientImpl(this); + this.transitHubs = new TransitHubsClientImpl(this); + this.enclaveConnections = new EnclaveConnectionsClientImpl(this); + this.enclaveEndpoints = new EnclaveEndpointsClientImpl(this); + this.communityEndpoints = new CommunityEndpointsClientImpl(this); + this.approvals = new ApprovalsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualEnclavesManagementClientImpl.class); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadResourceImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadResourceImpl.java new file mode 100644 index 000000000000..955f2f481661 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadResourceImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.WorkloadResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadProperties; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadResource; +import java.util.Collections; +import java.util.Map; + +public final class WorkloadResourceImpl + implements WorkloadResource, WorkloadResource.Definition, WorkloadResource.Update { + private WorkloadResourceInner innerObject; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public WorkloadProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public WorkloadResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualEnclaveName; + + private String workloadName; + + private WorkloadPatchModel updateProperties; + + public WorkloadResourceImpl withExistingVirtualEnclave(String resourceGroupName, String virtualEnclaveName) { + this.resourceGroupName = resourceGroupName; + this.virtualEnclaveName = virtualEnclaveName; + return this; + } + + public WorkloadResource create() { + this.innerObject = serviceManager.serviceClient() + .getWorkloads() + .createOrUpdate(resourceGroupName, virtualEnclaveName, workloadName, this.innerModel(), Context.NONE); + return this; + } + + public WorkloadResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkloads() + .createOrUpdate(resourceGroupName, virtualEnclaveName, workloadName, this.innerModel(), context); + return this; + } + + WorkloadResourceImpl(String name, com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = new WorkloadResourceInner(); + this.serviceManager = serviceManager; + this.workloadName = name; + } + + public WorkloadResourceImpl update() { + this.updateProperties = new WorkloadPatchModel(); + return this; + } + + public WorkloadResource apply() { + this.innerObject = serviceManager.serviceClient() + .getWorkloads() + .update(resourceGroupName, virtualEnclaveName, workloadName, updateProperties, Context.NONE); + return this; + } + + public WorkloadResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkloads() + .update(resourceGroupName, virtualEnclaveName, workloadName, updateProperties, context); + return this; + } + + WorkloadResourceImpl(WorkloadResourceInner innerObject, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "virtualEnclaves"); + this.workloadName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workloads"); + } + + public WorkloadResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getWorkloads() + .getWithResponse(resourceGroupName, virtualEnclaveName, workloadName, Context.NONE) + .getValue(); + return this; + } + + public WorkloadResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkloads() + .getWithResponse(resourceGroupName, virtualEnclaveName, workloadName, context) + .getValue(); + return this; + } + + public WorkloadResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public WorkloadResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public WorkloadResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public WorkloadResourceImpl withProperties(WorkloadProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public WorkloadResourceImpl withProperties(WorkloadPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadsClientImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadsClientImpl.java new file mode 100644 index 000000000000..6668e70918b5 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadsClientImpl.java @@ -0,0 +1,1187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.WorkloadResourceInner; +import com.azure.resourcemanager.virtualenclaves.implementation.models.WorkloadResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchModel; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in WorkloadsClient. + */ +public final class WorkloadsClientImpl implements WorkloadsClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkloadsService service; + + /** + * The service client containing this operation class. + */ + private final VirtualEnclavesManagementClientImpl client; + + /** + * Initializes an instance of WorkloadsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkloadsClientImpl(VirtualEnclavesManagementClientImpl client) { + this.service + = RestProxy.create(WorkloadsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for VirtualEnclavesManagementClientWorkloads to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "VirtualEnclavesManagementClientWorkloads") + public interface WorkloadsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads/{workloadName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @PathParam("workloadName") String workloadName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads/{workloadName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @PathParam("workloadName") String workloadName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads/{workloadName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @PathParam("workloadName") String workloadName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkloadResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads/{workloadName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @PathParam("workloadName") String workloadName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkloadResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads/{workloadName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @PathParam("workloadName") String workloadName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkloadPatchModel properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads/{workloadName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @PathParam("workloadName") String workloadName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkloadPatchModel properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads/{workloadName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @PathParam("workloadName") String workloadName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads/{workloadName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @PathParam("workloadName") String workloadName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByEnclaveResource(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByEnclaveResourceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByEnclaveResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByEnclaveResourceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String workloadName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String virtualEnclaveName, + String workloadName) { + return getWithResponseAsync(resourceGroupName, virtualEnclaveName, workloadName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String virtualEnclaveName, + String workloadName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, virtualEnclaveName, workloadName, accept, context); + } + + /** + * Get a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadResourceInner get(String resourceGroupName, String virtualEnclaveName, String workloadName) { + return getWithResponse(resourceGroupName, virtualEnclaveName, workloadName, Context.NONE).getValue(); + } + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String workloadName, WorkloadResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, contentType, + accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String virtualEnclaveName, + String workloadName, WorkloadResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, contentType, accept, + resource, Context.NONE); + } + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String virtualEnclaveName, + String workloadName, WorkloadResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, contentType, accept, + resource, context); + } + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkloadResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String virtualEnclaveName, String workloadName, WorkloadResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, virtualEnclaveName, workloadName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), WorkloadResourceInner.class, WorkloadResourceInner.class, + this.client.getContext()); + } + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkloadResourceInner> beginCreateOrUpdate( + String resourceGroupName, String virtualEnclaveName, String workloadName, WorkloadResourceInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, virtualEnclaveName, workloadName, resource); + return this.client.getLroResult(response, + WorkloadResourceInner.class, WorkloadResourceInner.class, Context.NONE); + } + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkloadResourceInner> beginCreateOrUpdate( + String resourceGroupName, String virtualEnclaveName, String workloadName, WorkloadResourceInner resource, + Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, virtualEnclaveName, workloadName, resource, context); + return this.client.getLroResult(response, + WorkloadResourceInner.class, WorkloadResourceInner.class, context); + } + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String virtualEnclaveName, + String workloadName, WorkloadResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, workloadName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, + String workloadName, WorkloadResourceInner resource) { + return beginCreateOrUpdate(resourceGroupName, virtualEnclaveName, workloadName, resource).getFinalResult(); + } + + /** + * Create a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadResourceInner createOrUpdate(String resourceGroupName, String virtualEnclaveName, + String workloadName, WorkloadResourceInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, virtualEnclaveName, workloadName, resource, context) + .getFinalResult(); + } + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String workloadName, WorkloadPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, contentType, + accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String virtualEnclaveName, + String workloadName, WorkloadPatchModel properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, contentType, accept, + properties, Context.NONE); + } + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String virtualEnclaveName, + String workloadName, WorkloadPatchModel properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, contentType, accept, + properties, context); + } + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkloadResourceInner> beginUpdateAsync( + String resourceGroupName, String virtualEnclaveName, String workloadName, WorkloadPatchModel properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, virtualEnclaveName, workloadName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), WorkloadResourceInner.class, WorkloadResourceInner.class, + this.client.getContext()); + } + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkloadResourceInner> beginUpdate(String resourceGroupName, + String virtualEnclaveName, String workloadName, WorkloadPatchModel properties) { + Response response + = updateWithResponse(resourceGroupName, virtualEnclaveName, workloadName, properties); + return this.client.getLroResult(response, + WorkloadResourceInner.class, WorkloadResourceInner.class, Context.NONE); + } + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkloadResourceInner> beginUpdate(String resourceGroupName, + String virtualEnclaveName, String workloadName, WorkloadPatchModel properties, Context context) { + Response response + = updateWithResponse(resourceGroupName, virtualEnclaveName, workloadName, properties, context); + return this.client.getLroResult(response, + WorkloadResourceInner.class, WorkloadResourceInner.class, context); + } + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String virtualEnclaveName, + String workloadName, WorkloadPatchModel properties) { + return beginUpdateAsync(resourceGroupName, virtualEnclaveName, workloadName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadResourceInner update(String resourceGroupName, String virtualEnclaveName, String workloadName, + WorkloadPatchModel properties) { + return beginUpdate(resourceGroupName, virtualEnclaveName, workloadName, properties).getFinalResult(); + } + + /** + * Update a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkloadResourceInner update(String resourceGroupName, String virtualEnclaveName, String workloadName, + WorkloadPatchModel properties, Context context) { + return beginUpdate(resourceGroupName, virtualEnclaveName, workloadName, properties, context).getFinalResult(); + } + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String workloadName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String virtualEnclaveName, + String workloadName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, Context.NONE); + } + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String virtualEnclaveName, + String workloadName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, context); + } + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String virtualEnclaveName, + String workloadName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, virtualEnclaveName, workloadName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName, + String workloadName) { + Response response = deleteWithResponse(resourceGroupName, virtualEnclaveName, workloadName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName, + String workloadName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, virtualEnclaveName, workloadName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String virtualEnclaveName, String workloadName) { + return beginDeleteAsync(resourceGroupName, virtualEnclaveName, workloadName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String virtualEnclaveName, String workloadName) { + beginDelete(resourceGroupName, virtualEnclaveName, workloadName).getFinalResult(); + } + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String virtualEnclaveName, String workloadName, Context context) { + beginDelete(resourceGroupName, virtualEnclaveName, workloadName, context).getFinalResult(); + } + + /** + * List WorkloadResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByEnclaveResourceSinglePageAsync(String resourceGroupName, + String virtualEnclaveName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByEnclaveResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List WorkloadResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByEnclaveResourceAsync(String resourceGroupName, + String virtualEnclaveName) { + return new PagedFlux<>(() -> listByEnclaveResourceSinglePageAsync(resourceGroupName, virtualEnclaveName), + nextLink -> listByEnclaveResourceNextSinglePageAsync(nextLink)); + } + + /** + * List WorkloadResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnclaveResourceSinglePage(String resourceGroupName, + String virtualEnclaveName) { + final String accept = "application/json"; + Response res + = service.listByEnclaveResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List WorkloadResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnclaveResourceSinglePage(String resourceGroupName, + String virtualEnclaveName, Context context) { + final String accept = "application/json"; + Response res + = service.listByEnclaveResourceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List WorkloadResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByEnclaveResource(String resourceGroupName, + String virtualEnclaveName) { + return new PagedIterable<>(() -> listByEnclaveResourceSinglePage(resourceGroupName, virtualEnclaveName), + nextLink -> listByEnclaveResourceNextSinglePage(nextLink)); + } + + /** + * List WorkloadResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByEnclaveResource(String resourceGroupName, + String virtualEnclaveName, Context context) { + return new PagedIterable<>( + () -> listByEnclaveResourceSinglePage(resourceGroupName, virtualEnclaveName, context), + nextLink -> listByEnclaveResourceNextSinglePage(nextLink, context)); + } + + /** + * List WorkloadResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(String virtualEnclaveName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), virtualEnclaveName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List WorkloadResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String virtualEnclaveName) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(virtualEnclaveName), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List WorkloadResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(String virtualEnclaveName) { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), virtualEnclaveName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List WorkloadResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(String virtualEnclaveName, + Context context) { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), virtualEnclaveName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List WorkloadResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String virtualEnclaveName) { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(virtualEnclaveName), + nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List WorkloadResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String virtualEnclaveName, Context context) { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(virtualEnclaveName, context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByEnclaveResourceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByEnclaveResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnclaveResourceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByEnclaveResourceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByEnclaveResourceNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByEnclaveResourceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadsImpl.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadsImpl.java new file mode 100644 index 000000000000..df0093e29d2e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadsImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient; +import com.azure.resourcemanager.virtualenclaves.fluent.models.WorkloadResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadResource; +import com.azure.resourcemanager.virtualenclaves.models.Workloads; + +public final class WorkloadsImpl implements Workloads { + private static final ClientLogger LOGGER = new ClientLogger(WorkloadsImpl.class); + + private final WorkloadsClient innerClient; + + private final com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager; + + public WorkloadsImpl(WorkloadsClient innerClient, + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String virtualEnclaveName, + String workloadName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, virtualEnclaveName, workloadName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkloadResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WorkloadResource get(String resourceGroupName, String virtualEnclaveName, String workloadName) { + WorkloadResourceInner inner = this.serviceClient().get(resourceGroupName, virtualEnclaveName, workloadName); + if (inner != null) { + return new WorkloadResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String virtualEnclaveName, String workloadName) { + this.serviceClient().delete(resourceGroupName, virtualEnclaveName, workloadName); + } + + public void delete(String resourceGroupName, String virtualEnclaveName, String workloadName, Context context) { + this.serviceClient().delete(resourceGroupName, virtualEnclaveName, workloadName, context); + } + + public PagedIterable listByEnclaveResource(String resourceGroupName, String virtualEnclaveName) { + PagedIterable inner + = this.serviceClient().listByEnclaveResource(resourceGroupName, virtualEnclaveName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkloadResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByEnclaveResource(String resourceGroupName, String virtualEnclaveName, + Context context) { + PagedIterable inner + = this.serviceClient().listByEnclaveResource(resourceGroupName, virtualEnclaveName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkloadResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(String virtualEnclaveName) { + PagedIterable inner = this.serviceClient().listBySubscription(virtualEnclaveName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkloadResourceImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(String virtualEnclaveName, Context context) { + PagedIterable inner + = this.serviceClient().listBySubscription(virtualEnclaveName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkloadResourceImpl(inner1, this.manager())); + } + + public WorkloadResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + String workloadName = ResourceManagerUtils.getValueFromIdByName(id, "workloads"); + if (workloadName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloads'.", id))); + } + return this.getWithResponse(resourceGroupName, virtualEnclaveName, workloadName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + String workloadName = ResourceManagerUtils.getValueFromIdByName(id, "workloads"); + if (workloadName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloads'.", id))); + } + return this.getWithResponse(resourceGroupName, virtualEnclaveName, workloadName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + String workloadName = ResourceManagerUtils.getValueFromIdByName(id, "workloads"); + if (workloadName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloads'.", id))); + } + this.delete(resourceGroupName, virtualEnclaveName, workloadName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String virtualEnclaveName = ResourceManagerUtils.getValueFromIdByName(id, "virtualEnclaves"); + if (virtualEnclaveName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualEnclaves'.", id))); + } + String workloadName = ResourceManagerUtils.getValueFromIdByName(id, "workloads"); + if (workloadName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workloads'.", id))); + } + this.delete(resourceGroupName, virtualEnclaveName, workloadName, context); + } + + private WorkloadsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager() { + return this.serviceManager; + } + + public WorkloadResourceImpl define(String name) { + return new WorkloadResourceImpl(name, this.manager()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/ApprovalResourceListResult.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/ApprovalResourceListResult.java new file mode 100644 index 000000000000..2330b18d7af5 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/ApprovalResourceListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a ApprovalResource list operation. + */ +@Immutable +public final class ApprovalResourceListResult implements JsonSerializable { + /* + * The ApprovalResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ApprovalResourceListResult class. + */ + private ApprovalResourceListResult() { + } + + /** + * Get the value property: The ApprovalResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalResourceListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApprovalResourceListResult. + */ + public static ApprovalResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalResourceListResult deserializedApprovalResourceListResult = new ApprovalResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ApprovalResourceInner.fromJson(reader1)); + deserializedApprovalResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedApprovalResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalResourceListResult; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/CommunityEndpointResourceListResult.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/CommunityEndpointResourceListResult.java new file mode 100644 index 000000000000..1eecc6179d8c --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/CommunityEndpointResourceListResult.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityEndpointResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a CommunityEndpointResource list operation. + */ +@Immutable +public final class CommunityEndpointResourceListResult + implements JsonSerializable { + /* + * The CommunityEndpointResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of CommunityEndpointResourceListResult class. + */ + private CommunityEndpointResourceListResult() { + } + + /** + * Get the value property: The CommunityEndpointResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunityEndpointResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityEndpointResourceListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CommunityEndpointResourceListResult. + */ + public static CommunityEndpointResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityEndpointResourceListResult deserializedCommunityEndpointResourceListResult + = new CommunityEndpointResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CommunityEndpointResourceInner.fromJson(reader1)); + deserializedCommunityEndpointResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCommunityEndpointResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityEndpointResourceListResult; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/CommunityResourceListResult.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/CommunityResourceListResult.java new file mode 100644 index 000000000000..dd04982416ce --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/CommunityResourceListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a CommunityResource list operation. + */ +@Immutable +public final class CommunityResourceListResult implements JsonSerializable { + /* + * The CommunityResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of CommunityResourceListResult class. + */ + private CommunityResourceListResult() { + } + + /** + * Get the value property: The CommunityResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunityResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityResourceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CommunityResourceListResult. + */ + public static CommunityResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityResourceListResult deserializedCommunityResourceListResult = new CommunityResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CommunityResourceInner.fromJson(reader1)); + deserializedCommunityResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCommunityResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityResourceListResult; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveConnectionResourceListResult.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveConnectionResourceListResult.java new file mode 100644 index 000000000000..e14755e8345a --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveConnectionResourceListResult.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveConnectionResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a EnclaveConnectionResource list operation. + */ +@Immutable +public final class EnclaveConnectionResourceListResult + implements JsonSerializable { + /* + * The EnclaveConnectionResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of EnclaveConnectionResourceListResult class. + */ + private EnclaveConnectionResourceListResult() { + } + + /** + * Get the value property: The EnclaveConnectionResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveConnectionResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveConnectionResourceListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnclaveConnectionResourceListResult. + */ + public static EnclaveConnectionResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveConnectionResourceListResult deserializedEnclaveConnectionResourceListResult + = new EnclaveConnectionResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> EnclaveConnectionResourceInner.fromJson(reader1)); + deserializedEnclaveConnectionResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedEnclaveConnectionResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveConnectionResourceListResult; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveEndpointResourceListResult.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveEndpointResourceListResult.java new file mode 100644 index 000000000000..078762be1bbd --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveEndpointResourceListResult.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveEndpointResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a EnclaveEndpointResource list operation. + */ +@Immutable +public final class EnclaveEndpointResourceListResult implements JsonSerializable { + /* + * The EnclaveEndpointResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of EnclaveEndpointResourceListResult class. + */ + private EnclaveEndpointResourceListResult() { + } + + /** + * Get the value property: The EnclaveEndpointResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveEndpointResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveEndpointResourceListResult if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnclaveEndpointResourceListResult. + */ + public static EnclaveEndpointResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveEndpointResourceListResult deserializedEnclaveEndpointResourceListResult + = new EnclaveEndpointResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> EnclaveEndpointResourceInner.fromJson(reader1)); + deserializedEnclaveEndpointResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedEnclaveEndpointResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveEndpointResourceListResult; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveResourceListResult.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveResourceListResult.java new file mode 100644 index 000000000000..5769156c38ce --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveResourceListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a EnclaveResource list operation. + */ +@Immutable +public final class EnclaveResourceListResult implements JsonSerializable { + /* + * The EnclaveResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of EnclaveResourceListResult class. + */ + private EnclaveResourceListResult() { + } + + /** + * Get the value property: The EnclaveResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveResourceListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnclaveResourceListResult. + */ + public static EnclaveResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveResourceListResult deserializedEnclaveResourceListResult = new EnclaveResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> EnclaveResourceInner.fromJson(reader1)); + deserializedEnclaveResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedEnclaveResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveResourceListResult; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/OperationListResult.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..31194452de69 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/TransitHubResourceListResult.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/TransitHubResourceListResult.java new file mode 100644 index 000000000000..022fc3891cf3 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/TransitHubResourceListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.fluent.models.TransitHubResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a TransitHubResource list operation. + */ +@Immutable +public final class TransitHubResourceListResult implements JsonSerializable { + /* + * The TransitHubResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of TransitHubResourceListResult class. + */ + private TransitHubResourceListResult() { + } + + /** + * Get the value property: The TransitHubResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TransitHubResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TransitHubResourceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TransitHubResourceListResult. + */ + public static TransitHubResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TransitHubResourceListResult deserializedTransitHubResourceListResult = new TransitHubResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> TransitHubResourceInner.fromJson(reader1)); + deserializedTransitHubResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedTransitHubResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTransitHubResourceListResult; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/WorkloadResourceListResult.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/WorkloadResourceListResult.java new file mode 100644 index 000000000000..60352999bcda --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/WorkloadResourceListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.virtualenclaves.fluent.models.WorkloadResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a WorkloadResource list operation. + */ +@Immutable +public final class WorkloadResourceListResult implements JsonSerializable { + /* + * The WorkloadResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of WorkloadResourceListResult class. + */ + private WorkloadResourceListResult() { + } + + /** + * Get the value property: The WorkloadResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadResourceListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkloadResourceListResult. + */ + public static WorkloadResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadResourceListResult deserializedWorkloadResourceListResult = new WorkloadResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkloadResourceInner.fromJson(reader1)); + deserializedWorkloadResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkloadResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadResourceListResult; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/package-info.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/package-info.java new file mode 100644 index 000000000000..a1f1866c88ea --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for VirtualEnclavesManagementClient. + * Microsoft Mission Resource Provider management API. + */ +package com.azure.resourcemanager.virtualenclaves.implementation; diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ActionPerformed.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ActionPerformed.java new file mode 100644 index 000000000000..90d3a831d889 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ActionPerformed.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the action performed by the approver. + */ +public final class ActionPerformed extends ExpandableStringEnum { + /** + * Action was Approved. + */ + public static final ActionPerformed APPROVED = fromString("Approved"); + + /** + * Action was Rejected. + */ + public static final ActionPerformed REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of ActionPerformed value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionPerformed() { + } + + /** + * Creates or finds a ActionPerformed from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionPerformed. + */ + public static ActionPerformed fromString(String name) { + return fromString(name, ActionPerformed.class); + } + + /** + * Gets known ActionPerformed values. + * + * @return known ActionPerformed values. + */ + public static Collection values() { + return values(ActionPerformed.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ActionType.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ActionType.java new file mode 100644 index 000000000000..5e4c6f6eb0a6 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionRequest.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionRequest.java new file mode 100644 index 000000000000..6a84a522b60b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionRequest.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request body for calling post-action. + */ +@Fluent +public final class ApprovalActionRequest implements JsonSerializable { + /* + * Approval status indicating 'Approved' or 'Rejected' + */ + private ApprovalActionRequestApprovalStatus approvalStatus; + + /** + * Creates an instance of ApprovalActionRequest class. + */ + public ApprovalActionRequest() { + } + + /** + * Get the approvalStatus property: Approval status indicating 'Approved' or 'Rejected'. + * + * @return the approvalStatus value. + */ + public ApprovalActionRequestApprovalStatus approvalStatus() { + return this.approvalStatus; + } + + /** + * Set the approvalStatus property: Approval status indicating 'Approved' or 'Rejected'. + * + * @param approvalStatus the approvalStatus value to set. + * @return the ApprovalActionRequest object itself. + */ + public ApprovalActionRequest withApprovalStatus(ApprovalActionRequestApprovalStatus approvalStatus) { + this.approvalStatus = approvalStatus; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("approvalStatus", + this.approvalStatus == null ? null : this.approvalStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalActionRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalActionRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApprovalActionRequest. + */ + public static ApprovalActionRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalActionRequest deserializedApprovalActionRequest = new ApprovalActionRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("approvalStatus".equals(fieldName)) { + deserializedApprovalActionRequest.approvalStatus + = ApprovalActionRequestApprovalStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalActionRequest; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionRequestApprovalStatus.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionRequestApprovalStatus.java new file mode 100644 index 000000000000..625c4e2ed780 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionRequestApprovalStatus.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ApprovalActionRequestApprovalStatus. + */ +public final class ApprovalActionRequestApprovalStatus + extends ExpandableStringEnum { + /** + * Static value Approved for ApprovalActionRequestApprovalStatus. + */ + public static final ApprovalActionRequestApprovalStatus APPROVED = fromString("Approved"); + + /** + * Static value Rejected for ApprovalActionRequestApprovalStatus. + */ + public static final ApprovalActionRequestApprovalStatus REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of ApprovalActionRequestApprovalStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApprovalActionRequestApprovalStatus() { + } + + /** + * Creates or finds a ApprovalActionRequestApprovalStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApprovalActionRequestApprovalStatus. + */ + public static ApprovalActionRequestApprovalStatus fromString(String name) { + return fromString(name, ApprovalActionRequestApprovalStatus.class); + } + + /** + * Gets known ApprovalActionRequestApprovalStatus values. + * + * @return known ApprovalActionRequestApprovalStatus values. + */ + public static Collection values() { + return values(ApprovalActionRequestApprovalStatus.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionResponse.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionResponse.java new file mode 100644 index 000000000000..397e9d95e82f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionResponse.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; + +/** + * An immutable client-side representation of ApprovalActionResponse. + */ +public interface ApprovalActionResponse { + /** + * Gets the message property: Confirmation message indicating the result of the operation. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner object. + * + * @return the inner object. + */ + ApprovalActionResponseInner innerModel(); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequest.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequest.java new file mode 100644 index 000000000000..70fbc8e316c6 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequest.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request body for calling post-action. + */ +@Fluent +public final class ApprovalCallbackRequest implements JsonSerializable { + /* + * Resource request action indicating action which needed to be performed upon calling approval-callback post action + */ + private ApprovalCallbackRequestResourceRequestAction resourceRequestAction; + + /* + * Approval status indicating 'Approved' or 'Rejected' + */ + private ApprovalCallbackRequestApprovalStatus approvalStatus; + + /* + * Payload requested by client upon approval action + */ + private String approvalCallbackPayload; + + /** + * Creates an instance of ApprovalCallbackRequest class. + */ + public ApprovalCallbackRequest() { + } + + /** + * Get the resourceRequestAction property: Resource request action indicating action which needed to be performed + * upon calling approval-callback post action. + * + * @return the resourceRequestAction value. + */ + public ApprovalCallbackRequestResourceRequestAction resourceRequestAction() { + return this.resourceRequestAction; + } + + /** + * Set the resourceRequestAction property: Resource request action indicating action which needed to be performed + * upon calling approval-callback post action. + * + * @param resourceRequestAction the resourceRequestAction value to set. + * @return the ApprovalCallbackRequest object itself. + */ + public ApprovalCallbackRequest + withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction resourceRequestAction) { + this.resourceRequestAction = resourceRequestAction; + return this; + } + + /** + * Get the approvalStatus property: Approval status indicating 'Approved' or 'Rejected'. + * + * @return the approvalStatus value. + */ + public ApprovalCallbackRequestApprovalStatus approvalStatus() { + return this.approvalStatus; + } + + /** + * Set the approvalStatus property: Approval status indicating 'Approved' or 'Rejected'. + * + * @param approvalStatus the approvalStatus value to set. + * @return the ApprovalCallbackRequest object itself. + */ + public ApprovalCallbackRequest withApprovalStatus(ApprovalCallbackRequestApprovalStatus approvalStatus) { + this.approvalStatus = approvalStatus; + return this; + } + + /** + * Get the approvalCallbackPayload property: Payload requested by client upon approval action. + * + * @return the approvalCallbackPayload value. + */ + public String approvalCallbackPayload() { + return this.approvalCallbackPayload; + } + + /** + * Set the approvalCallbackPayload property: Payload requested by client upon approval action. + * + * @param approvalCallbackPayload the approvalCallbackPayload value to set. + * @return the ApprovalCallbackRequest object itself. + */ + public ApprovalCallbackRequest withApprovalCallbackPayload(String approvalCallbackPayload) { + this.approvalCallbackPayload = approvalCallbackPayload; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceRequestAction", + this.resourceRequestAction == null ? null : this.resourceRequestAction.toString()); + jsonWriter.writeStringField("approvalStatus", + this.approvalStatus == null ? null : this.approvalStatus.toString()); + jsonWriter.writeStringField("approvalCallbackPayload", this.approvalCallbackPayload); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalCallbackRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalCallbackRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApprovalCallbackRequest. + */ + public static ApprovalCallbackRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalCallbackRequest deserializedApprovalCallbackRequest = new ApprovalCallbackRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceRequestAction".equals(fieldName)) { + deserializedApprovalCallbackRequest.resourceRequestAction + = ApprovalCallbackRequestResourceRequestAction.fromString(reader.getString()); + } else if ("approvalStatus".equals(fieldName)) { + deserializedApprovalCallbackRequest.approvalStatus + = ApprovalCallbackRequestApprovalStatus.fromString(reader.getString()); + } else if ("approvalCallbackPayload".equals(fieldName)) { + deserializedApprovalCallbackRequest.approvalCallbackPayload = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalCallbackRequest; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequestApprovalStatus.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequestApprovalStatus.java new file mode 100644 index 000000000000..84a89dd4500f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequestApprovalStatus.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ApprovalCallbackRequestApprovalStatus. + */ +public final class ApprovalCallbackRequestApprovalStatus + extends ExpandableStringEnum { + /** + * Static value Approved for ApprovalCallbackRequestApprovalStatus. + */ + public static final ApprovalCallbackRequestApprovalStatus APPROVED = fromString("Approved"); + + /** + * Static value Rejected for ApprovalCallbackRequestApprovalStatus. + */ + public static final ApprovalCallbackRequestApprovalStatus REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of ApprovalCallbackRequestApprovalStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApprovalCallbackRequestApprovalStatus() { + } + + /** + * Creates or finds a ApprovalCallbackRequestApprovalStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApprovalCallbackRequestApprovalStatus. + */ + public static ApprovalCallbackRequestApprovalStatus fromString(String name) { + return fromString(name, ApprovalCallbackRequestApprovalStatus.class); + } + + /** + * Gets known ApprovalCallbackRequestApprovalStatus values. + * + * @return known ApprovalCallbackRequestApprovalStatus values. + */ + public static Collection values() { + return values(ApprovalCallbackRequestApprovalStatus.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequestResourceRequestAction.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequestResourceRequestAction.java new file mode 100644 index 000000000000..5772fe6d83ce --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequestResourceRequestAction.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ApprovalCallbackRequestResourceRequestAction. + */ +public final class ApprovalCallbackRequestResourceRequestAction + extends ExpandableStringEnum { + /** + * Static value Create for ApprovalCallbackRequestResourceRequestAction. + */ + public static final ApprovalCallbackRequestResourceRequestAction CREATE = fromString("Create"); + + /** + * Static value Delete for ApprovalCallbackRequestResourceRequestAction. + */ + public static final ApprovalCallbackRequestResourceRequestAction DELETE = fromString("Delete"); + + /** + * Static value Update for ApprovalCallbackRequestResourceRequestAction. + */ + public static final ApprovalCallbackRequestResourceRequestAction UPDATE = fromString("Update"); + + /** + * Static value Reset for ApprovalCallbackRequestResourceRequestAction. + */ + public static final ApprovalCallbackRequestResourceRequestAction RESET = fromString("Reset"); + + /** + * Creates a new instance of ApprovalCallbackRequestResourceRequestAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApprovalCallbackRequestResourceRequestAction() { + } + + /** + * Creates or finds a ApprovalCallbackRequestResourceRequestAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApprovalCallbackRequestResourceRequestAction. + */ + public static ApprovalCallbackRequestResourceRequestAction fromString(String name) { + return fromString(name, ApprovalCallbackRequestResourceRequestAction.class); + } + + /** + * Gets known ApprovalCallbackRequestResourceRequestAction values. + * + * @return known ApprovalCallbackRequestResourceRequestAction values. + */ + public static Collection values() { + return values(ApprovalCallbackRequestResourceRequestAction.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalDeletionCallbackRequest.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalDeletionCallbackRequest.java new file mode 100644 index 000000000000..bb46b704ed89 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalDeletionCallbackRequest.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request body for calling post-action. + */ +@Fluent +public final class ApprovalDeletionCallbackRequest implements JsonSerializable { + /* + * Resource request action indicating action which needed to be performed upon calling approval-deletion-callback + * post action + */ + private ApprovalDeletionCallbackRequestResourceRequestAction resourceRequestAction; + + /** + * Creates an instance of ApprovalDeletionCallbackRequest class. + */ + public ApprovalDeletionCallbackRequest() { + } + + /** + * Get the resourceRequestAction property: Resource request action indicating action which needed to be performed + * upon calling approval-deletion-callback post action. + * + * @return the resourceRequestAction value. + */ + public ApprovalDeletionCallbackRequestResourceRequestAction resourceRequestAction() { + return this.resourceRequestAction; + } + + /** + * Set the resourceRequestAction property: Resource request action indicating action which needed to be performed + * upon calling approval-deletion-callback post action. + * + * @param resourceRequestAction the resourceRequestAction value to set. + * @return the ApprovalDeletionCallbackRequest object itself. + */ + public ApprovalDeletionCallbackRequest + withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction resourceRequestAction) { + this.resourceRequestAction = resourceRequestAction; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceRequestAction", + this.resourceRequestAction == null ? null : this.resourceRequestAction.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalDeletionCallbackRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalDeletionCallbackRequest if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApprovalDeletionCallbackRequest. + */ + public static ApprovalDeletionCallbackRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalDeletionCallbackRequest deserializedApprovalDeletionCallbackRequest + = new ApprovalDeletionCallbackRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceRequestAction".equals(fieldName)) { + deserializedApprovalDeletionCallbackRequest.resourceRequestAction + = ApprovalDeletionCallbackRequestResourceRequestAction.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalDeletionCallbackRequest; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalDeletionCallbackRequestResourceRequestAction.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalDeletionCallbackRequestResourceRequestAction.java new file mode 100644 index 000000000000..a523cd09307e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalDeletionCallbackRequestResourceRequestAction.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for ApprovalDeletionCallbackRequestResourceRequestAction. + */ +public final class ApprovalDeletionCallbackRequestResourceRequestAction + extends ExpandableStringEnum { + /** + * Static value Create for ApprovalDeletionCallbackRequestResourceRequestAction. + */ + public static final ApprovalDeletionCallbackRequestResourceRequestAction CREATE = fromString("Create"); + + /** + * Static value Delete for ApprovalDeletionCallbackRequestResourceRequestAction. + */ + public static final ApprovalDeletionCallbackRequestResourceRequestAction DELETE = fromString("Delete"); + + /** + * Static value Update for ApprovalDeletionCallbackRequestResourceRequestAction. + */ + public static final ApprovalDeletionCallbackRequestResourceRequestAction UPDATE = fromString("Update"); + + /** + * Creates a new instance of ApprovalDeletionCallbackRequestResourceRequestAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApprovalDeletionCallbackRequestResourceRequestAction() { + } + + /** + * Creates or finds a ApprovalDeletionCallbackRequestResourceRequestAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApprovalDeletionCallbackRequestResourceRequestAction. + */ + public static ApprovalDeletionCallbackRequestResourceRequestAction fromString(String name) { + return fromString(name, ApprovalDeletionCallbackRequestResourceRequestAction.class); + } + + /** + * Gets known ApprovalDeletionCallbackRequestResourceRequestAction values. + * + * @return known ApprovalDeletionCallbackRequestResourceRequestAction values. + */ + public static Collection values() { + return values(ApprovalDeletionCallbackRequestResourceRequestAction.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPatchModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPatchModel.java new file mode 100644 index 000000000000..b32f4d3c660e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPatchModel.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Approvals patch model. + */ +@Fluent +public final class ApprovalPatchModel implements JsonSerializable { + /* + * Approval Patch properties + */ + private ApprovalPatchProperties properties; + + /** + * Creates an instance of ApprovalPatchModel class. + */ + public ApprovalPatchModel() { + } + + /** + * Get the properties property: Approval Patch properties. + * + * @return the properties value. + */ + public ApprovalPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Approval Patch properties. + * + * @param properties the properties value to set. + * @return the ApprovalPatchModel object itself. + */ + public ApprovalPatchModel withProperties(ApprovalPatchProperties properties) { + this.properties = properties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalPatchModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalPatchModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ApprovalPatchModel. + */ + public static ApprovalPatchModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalPatchModel deserializedApprovalPatchModel = new ApprovalPatchModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedApprovalPatchModel.properties = ApprovalPatchProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalPatchModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPatchProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPatchProperties.java new file mode 100644 index 000000000000..1d730f3dc5ef --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPatchProperties.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Approvals patch properties. + */ +@Fluent +public final class ApprovalPatchProperties implements JsonSerializable { + /* + * Parameter for optimizing query results + */ + private String parentResourceId; + + /* + * Parameter for optimizing query results + */ + private String grandparentResourceId; + + /* + * List of approvers for the approval request + */ + private List approvers; + + /* + * Ticket ID for the approval request + */ + private String ticketId; + + /* + * Approval request creation time + */ + private OffsetDateTime createdAt; + + /* + * Approval request state change time, time at which approval request state changed from pending to approved or + * rejected. + */ + private OffsetDateTime stateChangedAt; + + /* + * Request metadata for the approval request. + */ + private RequestMetadataUpdatableProperties requestMetadata; + + /** + * Creates an instance of ApprovalPatchProperties class. + */ + public ApprovalPatchProperties() { + } + + /** + * Get the parentResourceId property: Parameter for optimizing query results. + * + * @return the parentResourceId value. + */ + public String parentResourceId() { + return this.parentResourceId; + } + + /** + * Set the parentResourceId property: Parameter for optimizing query results. + * + * @param parentResourceId the parentResourceId value to set. + * @return the ApprovalPatchProperties object itself. + */ + public ApprovalPatchProperties withParentResourceId(String parentResourceId) { + this.parentResourceId = parentResourceId; + return this; + } + + /** + * Get the grandparentResourceId property: Parameter for optimizing query results. + * + * @return the grandparentResourceId value. + */ + public String grandparentResourceId() { + return this.grandparentResourceId; + } + + /** + * Set the grandparentResourceId property: Parameter for optimizing query results. + * + * @param grandparentResourceId the grandparentResourceId value to set. + * @return the ApprovalPatchProperties object itself. + */ + public ApprovalPatchProperties withGrandparentResourceId(String grandparentResourceId) { + this.grandparentResourceId = grandparentResourceId; + return this; + } + + /** + * Get the approvers property: List of approvers for the approval request. + * + * @return the approvers value. + */ + public List approvers() { + return this.approvers; + } + + /** + * Set the approvers property: List of approvers for the approval request. + * + * @param approvers the approvers value to set. + * @return the ApprovalPatchProperties object itself. + */ + public ApprovalPatchProperties withApprovers(List approvers) { + this.approvers = approvers; + return this; + } + + /** + * Get the ticketId property: Ticket ID for the approval request. + * + * @return the ticketId value. + */ + public String ticketId() { + return this.ticketId; + } + + /** + * Set the ticketId property: Ticket ID for the approval request. + * + * @param ticketId the ticketId value to set. + * @return the ApprovalPatchProperties object itself. + */ + public ApprovalPatchProperties withTicketId(String ticketId) { + this.ticketId = ticketId; + return this; + } + + /** + * Get the createdAt property: Approval request creation time. + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: Approval request creation time. + * + * @param createdAt the createdAt value to set. + * @return the ApprovalPatchProperties object itself. + */ + public ApprovalPatchProperties withCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the stateChangedAt property: Approval request state change time, time at which approval request state changed + * from pending to approved or rejected. + * + * @return the stateChangedAt value. + */ + public OffsetDateTime stateChangedAt() { + return this.stateChangedAt; + } + + /** + * Set the stateChangedAt property: Approval request state change time, time at which approval request state changed + * from pending to approved or rejected. + * + * @param stateChangedAt the stateChangedAt value to set. + * @return the ApprovalPatchProperties object itself. + */ + public ApprovalPatchProperties withStateChangedAt(OffsetDateTime stateChangedAt) { + this.stateChangedAt = stateChangedAt; + return this; + } + + /** + * Get the requestMetadata property: Request metadata for the approval request. + * + * @return the requestMetadata value. + */ + public RequestMetadataUpdatableProperties requestMetadata() { + return this.requestMetadata; + } + + /** + * Set the requestMetadata property: Request metadata for the approval request. + * + * @param requestMetadata the requestMetadata value to set. + * @return the ApprovalPatchProperties object itself. + */ + public ApprovalPatchProperties withRequestMetadata(RequestMetadataUpdatableProperties requestMetadata) { + this.requestMetadata = requestMetadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("requestMetadata", this.requestMetadata); + jsonWriter.writeStringField("parentResourceId", this.parentResourceId); + jsonWriter.writeStringField("grandparentResourceId", this.grandparentResourceId); + jsonWriter.writeArrayField("approvers", this.approvers, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("ticketId", this.ticketId); + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + jsonWriter.writeStringField("stateChangedAt", + this.stateChangedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.stateChangedAt)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalPatchProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApprovalPatchProperties. + */ + public static ApprovalPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalPatchProperties deserializedApprovalPatchProperties = new ApprovalPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requestMetadata".equals(fieldName)) { + deserializedApprovalPatchProperties.requestMetadata + = RequestMetadataUpdatableProperties.fromJson(reader); + } else if ("parentResourceId".equals(fieldName)) { + deserializedApprovalPatchProperties.parentResourceId = reader.getString(); + } else if ("grandparentResourceId".equals(fieldName)) { + deserializedApprovalPatchProperties.grandparentResourceId = reader.getString(); + } else if ("approvers".equals(fieldName)) { + List approvers = reader.readArray(reader1 -> Approver.fromJson(reader1)); + deserializedApprovalPatchProperties.approvers = approvers; + } else if ("ticketId".equals(fieldName)) { + deserializedApprovalPatchProperties.ticketId = reader.getString(); + } else if ("createdAt".equals(fieldName)) { + deserializedApprovalPatchProperties.createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("stateChangedAt".equals(fieldName)) { + deserializedApprovalPatchProperties.stateChangedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalPatchProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPolicy.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPolicy.java new file mode 100644 index 000000000000..5f8da7084607 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPolicy.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Approval Policy. + */ +public final class ApprovalPolicy extends ExpandableStringEnum { + /** + * Approval will be required for the specified action. + */ + public static final ApprovalPolicy REQUIRED = fromString("Required"); + + /** + * Approval will not be required for the specified action. + */ + public static final ApprovalPolicy NOT_REQUIRED = fromString("NotRequired"); + + /** + * Creates a new instance of ApprovalPolicy value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApprovalPolicy() { + } + + /** + * Creates or finds a ApprovalPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApprovalPolicy. + */ + public static ApprovalPolicy fromString(String name) { + return fromString(name, ApprovalPolicy.class); + } + + /** + * Gets known ApprovalPolicy values. + * + * @return known ApprovalPolicy values. + */ + public static Collection values() { + return values(ApprovalPolicy.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalProperties.java new file mode 100644 index 000000000000..13d2c286f641 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalProperties.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Approval Base model. + */ +@Fluent +public final class ApprovalProperties implements JsonSerializable { + /* + * Provisioning State. + */ + private ProvisioningState provisioningState; + + /* + * Parameter for optimizing query results + */ + private String parentResourceId; + + /* + * Parameter for optimizing query results + */ + private String grandparentResourceId; + + /* + * List of approvers for the approval request + */ + private List approvers; + + /* + * Ticket ID for the approval request + */ + private String ticketId; + + /* + * Approval request creation time + */ + private OffsetDateTime createdAt; + + /* + * Approval request state change time, time at which approval request state changed from pending to approved or + * rejected. + */ + private OffsetDateTime stateChangedAt; + + /* + * Request metadata for the approval request. + */ + private RequestMetadata requestMetadata; + + /** + * Creates an instance of ApprovalProperties class. + */ + public ApprovalProperties() { + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the parentResourceId property: Parameter for optimizing query results. + * + * @return the parentResourceId value. + */ + public String parentResourceId() { + return this.parentResourceId; + } + + /** + * Set the parentResourceId property: Parameter for optimizing query results. + * + * @param parentResourceId the parentResourceId value to set. + * @return the ApprovalProperties object itself. + */ + public ApprovalProperties withParentResourceId(String parentResourceId) { + this.parentResourceId = parentResourceId; + return this; + } + + /** + * Get the grandparentResourceId property: Parameter for optimizing query results. + * + * @return the grandparentResourceId value. + */ + public String grandparentResourceId() { + return this.grandparentResourceId; + } + + /** + * Set the grandparentResourceId property: Parameter for optimizing query results. + * + * @param grandparentResourceId the grandparentResourceId value to set. + * @return the ApprovalProperties object itself. + */ + public ApprovalProperties withGrandparentResourceId(String grandparentResourceId) { + this.grandparentResourceId = grandparentResourceId; + return this; + } + + /** + * Get the approvers property: List of approvers for the approval request. + * + * @return the approvers value. + */ + public List approvers() { + return this.approvers; + } + + /** + * Set the approvers property: List of approvers for the approval request. + * + * @param approvers the approvers value to set. + * @return the ApprovalProperties object itself. + */ + public ApprovalProperties withApprovers(List approvers) { + this.approvers = approvers; + return this; + } + + /** + * Get the ticketId property: Ticket ID for the approval request. + * + * @return the ticketId value. + */ + public String ticketId() { + return this.ticketId; + } + + /** + * Set the ticketId property: Ticket ID for the approval request. + * + * @param ticketId the ticketId value to set. + * @return the ApprovalProperties object itself. + */ + public ApprovalProperties withTicketId(String ticketId) { + this.ticketId = ticketId; + return this; + } + + /** + * Get the createdAt property: Approval request creation time. + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: Approval request creation time. + * + * @param createdAt the createdAt value to set. + * @return the ApprovalProperties object itself. + */ + public ApprovalProperties withCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the stateChangedAt property: Approval request state change time, time at which approval request state changed + * from pending to approved or rejected. + * + * @return the stateChangedAt value. + */ + public OffsetDateTime stateChangedAt() { + return this.stateChangedAt; + } + + /** + * Set the stateChangedAt property: Approval request state change time, time at which approval request state changed + * from pending to approved or rejected. + * + * @param stateChangedAt the stateChangedAt value to set. + * @return the ApprovalProperties object itself. + */ + public ApprovalProperties withStateChangedAt(OffsetDateTime stateChangedAt) { + this.stateChangedAt = stateChangedAt; + return this; + } + + /** + * Get the requestMetadata property: Request metadata for the approval request. + * + * @return the requestMetadata value. + */ + public RequestMetadata requestMetadata() { + return this.requestMetadata; + } + + /** + * Set the requestMetadata property: Request metadata for the approval request. + * + * @param requestMetadata the requestMetadata value to set. + * @return the ApprovalProperties object itself. + */ + public ApprovalProperties withRequestMetadata(RequestMetadata requestMetadata) { + this.requestMetadata = requestMetadata; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("requestMetadata", this.requestMetadata); + jsonWriter.writeStringField("parentResourceId", this.parentResourceId); + jsonWriter.writeStringField("grandparentResourceId", this.grandparentResourceId); + jsonWriter.writeArrayField("approvers", this.approvers, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("ticketId", this.ticketId); + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + jsonWriter.writeStringField("stateChangedAt", + this.stateChangedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.stateChangedAt)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ApprovalProperties. + */ + public static ApprovalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalProperties deserializedApprovalProperties = new ApprovalProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requestMetadata".equals(fieldName)) { + deserializedApprovalProperties.requestMetadata = RequestMetadata.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedApprovalProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("parentResourceId".equals(fieldName)) { + deserializedApprovalProperties.parentResourceId = reader.getString(); + } else if ("grandparentResourceId".equals(fieldName)) { + deserializedApprovalProperties.grandparentResourceId = reader.getString(); + } else if ("approvers".equals(fieldName)) { + List approvers = reader.readArray(reader1 -> Approver.fromJson(reader1)); + deserializedApprovalProperties.approvers = approvers; + } else if ("ticketId".equals(fieldName)) { + deserializedApprovalProperties.ticketId = reader.getString(); + } else if ("createdAt".equals(fieldName)) { + deserializedApprovalProperties.createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("stateChangedAt".equals(fieldName)) { + deserializedApprovalProperties.stateChangedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalResource.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalResource.java new file mode 100644 index 000000000000..f5c9c94f3b75 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalResource.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalResourceInner; + +/** + * An immutable client-side representation of ApprovalResource. + */ +public interface ApprovalResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ApprovalProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalResourceInner object. + * + * @return the inner object. + */ + ApprovalResourceInner innerModel(); + + /** + * The entirety of the ApprovalResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + + /** + * The ApprovalResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ApprovalResource definition. + */ + interface Blank extends WithScope { + } + + /** + * The stage of the ApprovalResource definition allowing to specify parent resource. + */ + interface WithScope { + /** + * Specifies resourceUri. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + + /** + * The stage of the ApprovalResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ApprovalResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ApprovalResource create(Context context); + } + + /** + * The stage of the ApprovalResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ApprovalProperties properties); + } + } + + /** + * Begins update for the ApprovalResource resource. + * + * @return the stage of resource update. + */ + ApprovalResource.Update update(); + + /** + * The template for ApprovalResource update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ApprovalResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ApprovalResource apply(Context context); + } + + /** + * The ApprovalResource update stages. + */ + interface UpdateStages { + /** + * The stage of the ApprovalResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Approval Patch properties. + * + * @param properties Approval Patch properties. + * @return the next definition stage. + */ + Update withProperties(ApprovalPatchProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ApprovalResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ApprovalResource refresh(Context context); + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse notifyInitiator(ApprovalActionRequest body); + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse notifyInitiator(ApprovalActionRequest body, Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalSettings.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalSettings.java new file mode 100644 index 000000000000..c6f73f52f649 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalSettings.java @@ -0,0 +1,502 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * ApprovalSettings Properties. + */ +@Fluent +public final class ApprovalSettings implements JsonSerializable { + /* + * Approval required for endpoint creation (Required or NotRequired). + */ + private ApprovalPolicy endpointCreation; + + /* + * Approval required for endpoint update (Required or NotRequired). + */ + private ApprovalPolicy endpointUpdate; + + /* + * Approval required for endpoint deletion (Required or NotRequired). + */ + private ApprovalPolicy endpointDeletion; + + /* + * Approval required for enclave connection creation (Required or NotRequired). + */ + private ApprovalPolicy connectionCreation; + + /* + * Approval required for enclave connection update (Required or NotRequired). + */ + private ApprovalPolicy connectionUpdate; + + /* + * Approval required for enclave connection deletion (Required or NotRequired). + */ + private ApprovalPolicy connectionDeletion; + + /* + * Approval required for virtual enclave creation (Required or NotRequired). + */ + private ApprovalPolicy enclaveCreation; + + /* + * Approval required for virtual enclave deletion (Required or NotRequired). + */ + private ApprovalPolicy enclaveDeletion; + + /* + * Approval required for toggling maintenance mode (Required or NotRequired). + */ + private ApprovalPolicy maintenanceMode; + + /* + * Approval required for deploying service catalog templates (Required or NotRequired). + */ + private ApprovalPolicy serviceCatalogDeployment; + + /* + * Notification will be sent on creation of an Approval Request + */ + private ApprovalPolicy notificationOnApprovalCreation; + + /* + * Notification will be sent on any action taken (Approve/Reject) on an Approval Request + */ + private ApprovalPolicy notificationOnApprovalAction; + + /* + * Notification will be sent on deletion of an Approval Request + */ + private ApprovalPolicy notificationOnApprovalDeletion; + + /* + * List of mandatory approvers for the approval request + */ + private List mandatoryApprovers; + + /* + * Minimum number of approvers required for the approval request + */ + private Long minimumApproversRequired; + + /** + * Creates an instance of ApprovalSettings class. + */ + public ApprovalSettings() { + } + + /** + * Get the endpointCreation property: Approval required for endpoint creation (Required or NotRequired). + * + * @return the endpointCreation value. + */ + public ApprovalPolicy endpointCreation() { + return this.endpointCreation; + } + + /** + * Set the endpointCreation property: Approval required for endpoint creation (Required or NotRequired). + * + * @param endpointCreation the endpointCreation value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withEndpointCreation(ApprovalPolicy endpointCreation) { + this.endpointCreation = endpointCreation; + return this; + } + + /** + * Get the endpointUpdate property: Approval required for endpoint update (Required or NotRequired). + * + * @return the endpointUpdate value. + */ + public ApprovalPolicy endpointUpdate() { + return this.endpointUpdate; + } + + /** + * Set the endpointUpdate property: Approval required for endpoint update (Required or NotRequired). + * + * @param endpointUpdate the endpointUpdate value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withEndpointUpdate(ApprovalPolicy endpointUpdate) { + this.endpointUpdate = endpointUpdate; + return this; + } + + /** + * Get the endpointDeletion property: Approval required for endpoint deletion (Required or NotRequired). + * + * @return the endpointDeletion value. + */ + public ApprovalPolicy endpointDeletion() { + return this.endpointDeletion; + } + + /** + * Set the endpointDeletion property: Approval required for endpoint deletion (Required or NotRequired). + * + * @param endpointDeletion the endpointDeletion value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withEndpointDeletion(ApprovalPolicy endpointDeletion) { + this.endpointDeletion = endpointDeletion; + return this; + } + + /** + * Get the connectionCreation property: Approval required for enclave connection creation (Required or NotRequired). + * + * @return the connectionCreation value. + */ + public ApprovalPolicy connectionCreation() { + return this.connectionCreation; + } + + /** + * Set the connectionCreation property: Approval required for enclave connection creation (Required or NotRequired). + * + * @param connectionCreation the connectionCreation value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withConnectionCreation(ApprovalPolicy connectionCreation) { + this.connectionCreation = connectionCreation; + return this; + } + + /** + * Get the connectionUpdate property: Approval required for enclave connection update (Required or NotRequired). + * + * @return the connectionUpdate value. + */ + public ApprovalPolicy connectionUpdate() { + return this.connectionUpdate; + } + + /** + * Set the connectionUpdate property: Approval required for enclave connection update (Required or NotRequired). + * + * @param connectionUpdate the connectionUpdate value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withConnectionUpdate(ApprovalPolicy connectionUpdate) { + this.connectionUpdate = connectionUpdate; + return this; + } + + /** + * Get the connectionDeletion property: Approval required for enclave connection deletion (Required or NotRequired). + * + * @return the connectionDeletion value. + */ + public ApprovalPolicy connectionDeletion() { + return this.connectionDeletion; + } + + /** + * Set the connectionDeletion property: Approval required for enclave connection deletion (Required or NotRequired). + * + * @param connectionDeletion the connectionDeletion value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withConnectionDeletion(ApprovalPolicy connectionDeletion) { + this.connectionDeletion = connectionDeletion; + return this; + } + + /** + * Get the enclaveCreation property: Approval required for virtual enclave creation (Required or NotRequired). + * + * @return the enclaveCreation value. + */ + public ApprovalPolicy enclaveCreation() { + return this.enclaveCreation; + } + + /** + * Set the enclaveCreation property: Approval required for virtual enclave creation (Required or NotRequired). + * + * @param enclaveCreation the enclaveCreation value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withEnclaveCreation(ApprovalPolicy enclaveCreation) { + this.enclaveCreation = enclaveCreation; + return this; + } + + /** + * Get the enclaveDeletion property: Approval required for virtual enclave deletion (Required or NotRequired). + * + * @return the enclaveDeletion value. + */ + public ApprovalPolicy enclaveDeletion() { + return this.enclaveDeletion; + } + + /** + * Set the enclaveDeletion property: Approval required for virtual enclave deletion (Required or NotRequired). + * + * @param enclaveDeletion the enclaveDeletion value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withEnclaveDeletion(ApprovalPolicy enclaveDeletion) { + this.enclaveDeletion = enclaveDeletion; + return this; + } + + /** + * Get the maintenanceMode property: Approval required for toggling maintenance mode (Required or NotRequired). + * + * @return the maintenanceMode value. + */ + public ApprovalPolicy maintenanceMode() { + return this.maintenanceMode; + } + + /** + * Set the maintenanceMode property: Approval required for toggling maintenance mode (Required or NotRequired). + * + * @param maintenanceMode the maintenanceMode value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withMaintenanceMode(ApprovalPolicy maintenanceMode) { + this.maintenanceMode = maintenanceMode; + return this; + } + + /** + * Get the serviceCatalogDeployment property: Approval required for deploying service catalog templates (Required or + * NotRequired). + * + * @return the serviceCatalogDeployment value. + */ + public ApprovalPolicy serviceCatalogDeployment() { + return this.serviceCatalogDeployment; + } + + /** + * Set the serviceCatalogDeployment property: Approval required for deploying service catalog templates (Required or + * NotRequired). + * + * @param serviceCatalogDeployment the serviceCatalogDeployment value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withServiceCatalogDeployment(ApprovalPolicy serviceCatalogDeployment) { + this.serviceCatalogDeployment = serviceCatalogDeployment; + return this; + } + + /** + * Get the notificationOnApprovalCreation property: Notification will be sent on creation of an Approval Request. + * + * @return the notificationOnApprovalCreation value. + */ + public ApprovalPolicy notificationOnApprovalCreation() { + return this.notificationOnApprovalCreation; + } + + /** + * Set the notificationOnApprovalCreation property: Notification will be sent on creation of an Approval Request. + * + * @param notificationOnApprovalCreation the notificationOnApprovalCreation value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withNotificationOnApprovalCreation(ApprovalPolicy notificationOnApprovalCreation) { + this.notificationOnApprovalCreation = notificationOnApprovalCreation; + return this; + } + + /** + * Get the notificationOnApprovalAction property: Notification will be sent on any action taken (Approve/Reject) on + * an Approval Request. + * + * @return the notificationOnApprovalAction value. + */ + public ApprovalPolicy notificationOnApprovalAction() { + return this.notificationOnApprovalAction; + } + + /** + * Set the notificationOnApprovalAction property: Notification will be sent on any action taken (Approve/Reject) on + * an Approval Request. + * + * @param notificationOnApprovalAction the notificationOnApprovalAction value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withNotificationOnApprovalAction(ApprovalPolicy notificationOnApprovalAction) { + this.notificationOnApprovalAction = notificationOnApprovalAction; + return this; + } + + /** + * Get the notificationOnApprovalDeletion property: Notification will be sent on deletion of an Approval Request. + * + * @return the notificationOnApprovalDeletion value. + */ + public ApprovalPolicy notificationOnApprovalDeletion() { + return this.notificationOnApprovalDeletion; + } + + /** + * Set the notificationOnApprovalDeletion property: Notification will be sent on deletion of an Approval Request. + * + * @param notificationOnApprovalDeletion the notificationOnApprovalDeletion value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withNotificationOnApprovalDeletion(ApprovalPolicy notificationOnApprovalDeletion) { + this.notificationOnApprovalDeletion = notificationOnApprovalDeletion; + return this; + } + + /** + * Get the mandatoryApprovers property: List of mandatory approvers for the approval request. + * + * @return the mandatoryApprovers value. + */ + public List mandatoryApprovers() { + return this.mandatoryApprovers; + } + + /** + * Set the mandatoryApprovers property: List of mandatory approvers for the approval request. + * + * @param mandatoryApprovers the mandatoryApprovers value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withMandatoryApprovers(List mandatoryApprovers) { + this.mandatoryApprovers = mandatoryApprovers; + return this; + } + + /** + * Get the minimumApproversRequired property: Minimum number of approvers required for the approval request. + * + * @return the minimumApproversRequired value. + */ + public Long minimumApproversRequired() { + return this.minimumApproversRequired; + } + + /** + * Set the minimumApproversRequired property: Minimum number of approvers required for the approval request. + * + * @param minimumApproversRequired the minimumApproversRequired value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withMinimumApproversRequired(Long minimumApproversRequired) { + this.minimumApproversRequired = minimumApproversRequired; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("endpointCreation", + this.endpointCreation == null ? null : this.endpointCreation.toString()); + jsonWriter.writeStringField("endpointUpdate", + this.endpointUpdate == null ? null : this.endpointUpdate.toString()); + jsonWriter.writeStringField("endpointDeletion", + this.endpointDeletion == null ? null : this.endpointDeletion.toString()); + jsonWriter.writeStringField("connectionCreation", + this.connectionCreation == null ? null : this.connectionCreation.toString()); + jsonWriter.writeStringField("connectionUpdate", + this.connectionUpdate == null ? null : this.connectionUpdate.toString()); + jsonWriter.writeStringField("connectionDeletion", + this.connectionDeletion == null ? null : this.connectionDeletion.toString()); + jsonWriter.writeStringField("enclaveCreation", + this.enclaveCreation == null ? null : this.enclaveCreation.toString()); + jsonWriter.writeStringField("enclaveDeletion", + this.enclaveDeletion == null ? null : this.enclaveDeletion.toString()); + jsonWriter.writeStringField("maintenanceMode", + this.maintenanceMode == null ? null : this.maintenanceMode.toString()); + jsonWriter.writeStringField("serviceCatalogDeployment", + this.serviceCatalogDeployment == null ? null : this.serviceCatalogDeployment.toString()); + jsonWriter.writeStringField("notificationOnApprovalCreation", + this.notificationOnApprovalCreation == null ? null : this.notificationOnApprovalCreation.toString()); + jsonWriter.writeStringField("notificationOnApprovalAction", + this.notificationOnApprovalAction == null ? null : this.notificationOnApprovalAction.toString()); + jsonWriter.writeStringField("notificationOnApprovalDeletion", + this.notificationOnApprovalDeletion == null ? null : this.notificationOnApprovalDeletion.toString()); + jsonWriter.writeArrayField("mandatoryApprovers", this.mandatoryApprovers, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("minimumApproversRequired", this.minimumApproversRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalSettings if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ApprovalSettings. + */ + public static ApprovalSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalSettings deserializedApprovalSettings = new ApprovalSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("endpointCreation".equals(fieldName)) { + deserializedApprovalSettings.endpointCreation = ApprovalPolicy.fromString(reader.getString()); + } else if ("endpointUpdate".equals(fieldName)) { + deserializedApprovalSettings.endpointUpdate = ApprovalPolicy.fromString(reader.getString()); + } else if ("endpointDeletion".equals(fieldName)) { + deserializedApprovalSettings.endpointDeletion = ApprovalPolicy.fromString(reader.getString()); + } else if ("connectionCreation".equals(fieldName)) { + deserializedApprovalSettings.connectionCreation = ApprovalPolicy.fromString(reader.getString()); + } else if ("connectionUpdate".equals(fieldName)) { + deserializedApprovalSettings.connectionUpdate = ApprovalPolicy.fromString(reader.getString()); + } else if ("connectionDeletion".equals(fieldName)) { + deserializedApprovalSettings.connectionDeletion = ApprovalPolicy.fromString(reader.getString()); + } else if ("enclaveCreation".equals(fieldName)) { + deserializedApprovalSettings.enclaveCreation = ApprovalPolicy.fromString(reader.getString()); + } else if ("enclaveDeletion".equals(fieldName)) { + deserializedApprovalSettings.enclaveDeletion = ApprovalPolicy.fromString(reader.getString()); + } else if ("maintenanceMode".equals(fieldName)) { + deserializedApprovalSettings.maintenanceMode = ApprovalPolicy.fromString(reader.getString()); + } else if ("serviceCatalogDeployment".equals(fieldName)) { + deserializedApprovalSettings.serviceCatalogDeployment + = ApprovalPolicy.fromString(reader.getString()); + } else if ("notificationOnApprovalCreation".equals(fieldName)) { + deserializedApprovalSettings.notificationOnApprovalCreation + = ApprovalPolicy.fromString(reader.getString()); + } else if ("notificationOnApprovalAction".equals(fieldName)) { + deserializedApprovalSettings.notificationOnApprovalAction + = ApprovalPolicy.fromString(reader.getString()); + } else if ("notificationOnApprovalDeletion".equals(fieldName)) { + deserializedApprovalSettings.notificationOnApprovalDeletion + = ApprovalPolicy.fromString(reader.getString()); + } else if ("mandatoryApprovers".equals(fieldName)) { + List mandatoryApprovers + = reader.readArray(reader1 -> MandatoryApprover.fromJson(reader1)); + deserializedApprovalSettings.mandatoryApprovers = mandatoryApprovers; + } else if ("minimumApproversRequired".equals(fieldName)) { + deserializedApprovalSettings.minimumApproversRequired = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalSettings; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalSettingsPatchProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalSettingsPatchProperties.java new file mode 100644 index 000000000000..5a5a85755f77 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalSettingsPatchProperties.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * ApprovalSettings Properties. + */ +@Fluent +public final class ApprovalSettingsPatchProperties implements JsonSerializable { + /* + * List of mandatory approvers for the approval request + */ + private List mandatoryApprovers; + + /** + * Creates an instance of ApprovalSettingsPatchProperties class. + */ + public ApprovalSettingsPatchProperties() { + } + + /** + * Get the mandatoryApprovers property: List of mandatory approvers for the approval request. + * + * @return the mandatoryApprovers value. + */ + public List mandatoryApprovers() { + return this.mandatoryApprovers; + } + + /** + * Set the mandatoryApprovers property: List of mandatory approvers for the approval request. + * + * @param mandatoryApprovers the mandatoryApprovers value to set. + * @return the ApprovalSettingsPatchProperties object itself. + */ + public ApprovalSettingsPatchProperties withMandatoryApprovers(List mandatoryApprovers) { + this.mandatoryApprovers = mandatoryApprovers; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("mandatoryApprovers", this.mandatoryApprovers, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalSettingsPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalSettingsPatchProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ApprovalSettingsPatchProperties. + */ + public static ApprovalSettingsPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalSettingsPatchProperties deserializedApprovalSettingsPatchProperties + = new ApprovalSettingsPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mandatoryApprovers".equals(fieldName)) { + List mandatoryApprovers + = reader.readArray(reader1 -> MandatoryApprover.fromJson(reader1)); + deserializedApprovalSettingsPatchProperties.mandatoryApprovers = mandatoryApprovers; + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalSettingsPatchProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalStatus.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalStatus.java new file mode 100644 index 000000000000..d64819f93d0f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalStatus.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Approval Status. It can be Approved, Rejected, Pending, Deleted or Expired. + */ +public final class ApprovalStatus extends ExpandableStringEnum { + /** + * ApprovalStatus Type Approved. + */ + public static final ApprovalStatus APPROVED = fromString("Approved"); + + /** + * ApprovalStatus Type Rejected. + */ + public static final ApprovalStatus REJECTED = fromString("Rejected"); + + /** + * ApprovalStatus Type Pending. + */ + public static final ApprovalStatus PENDING = fromString("Pending"); + + /** + * ApprovalStatus Type Deleted. + */ + public static final ApprovalStatus DELETED = fromString("Deleted"); + + /** + * ApprovalStatus Type Expired. + */ + public static final ApprovalStatus EXPIRED = fromString("Expired"); + + /** + * Creates a new instance of ApprovalStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApprovalStatus() { + } + + /** + * Creates or finds a ApprovalStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApprovalStatus. + */ + public static ApprovalStatus fromString(String name) { + return fromString(name, ApprovalStatus.class); + } + + /** + * Gets known ApprovalStatus values. + * + * @return known ApprovalStatus values. + */ + public static Collection values() { + return values(ApprovalStatus.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Approvals.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Approvals.java new file mode 100644 index 000000000000..97b58b0be574 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Approvals.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Approvals. + */ +public interface Approvals { + /** + * Get a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ApprovalResource along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String approvalName, Context context); + + /** + * Get a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ApprovalResource. + */ + ApprovalResource get(String resourceUri, String approvalName); + + /** + * List ApprovalResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByParent(String resourceUri); + + /** + * List ApprovalResource resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ApprovalResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByParent(String resourceUri, Context context); + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceUri, String approvalName); + + /** + * Delete a ApprovalResource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceUri, String approvalName, Context context); + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse notifyInitiator(String resourceUri, String approvalName, ApprovalActionRequest body); + + /** + * Upon receiving approval or rejection from approver, this facilitates actions on approval resource. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param approvalName The name of the approvals resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse notifyInitiator(String resourceUri, String approvalName, ApprovalActionRequest body, + Context context); + + /** + * Get a ApprovalResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ApprovalResource along with {@link Response}. + */ + ApprovalResource getById(String id); + + /** + * Get a ApprovalResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ApprovalResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a ApprovalResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a ApprovalResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ApprovalResource resource. + * + * @param name resource name. + * @return the first stage of the new ApprovalResource definition. + */ + ApprovalResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Approver.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Approver.java new file mode 100644 index 000000000000..cab25a4e38b5 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Approver.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Approver Metadata for approvals request. + */ +@Fluent +public final class Approver implements JsonSerializable { + /* + * Entra ObjectID of the approver + */ + private String approverEntraId; + + /* + * Action Performed by approver + */ + private ActionPerformed actionPerformed; + + /* + * approval request last updated at + */ + private OffsetDateTime lastUpdatedAt; + + /** + * Creates an instance of Approver class. + */ + public Approver() { + } + + /** + * Get the approverEntraId property: Entra ObjectID of the approver. + * + * @return the approverEntraId value. + */ + public String approverEntraId() { + return this.approverEntraId; + } + + /** + * Set the approverEntraId property: Entra ObjectID of the approver. + * + * @param approverEntraId the approverEntraId value to set. + * @return the Approver object itself. + */ + public Approver withApproverEntraId(String approverEntraId) { + this.approverEntraId = approverEntraId; + return this; + } + + /** + * Get the actionPerformed property: Action Performed by approver. + * + * @return the actionPerformed value. + */ + public ActionPerformed actionPerformed() { + return this.actionPerformed; + } + + /** + * Set the actionPerformed property: Action Performed by approver. + * + * @param actionPerformed the actionPerformed value to set. + * @return the Approver object itself. + */ + public Approver withActionPerformed(ActionPerformed actionPerformed) { + this.actionPerformed = actionPerformed; + return this; + } + + /** + * Get the lastUpdatedAt property: approval request last updated at. + * + * @return the lastUpdatedAt value. + */ + public OffsetDateTime lastUpdatedAt() { + return this.lastUpdatedAt; + } + + /** + * Set the lastUpdatedAt property: approval request last updated at. + * + * @param lastUpdatedAt the lastUpdatedAt value to set. + * @return the Approver object itself. + */ + public Approver withLastUpdatedAt(OffsetDateTime lastUpdatedAt) { + this.lastUpdatedAt = lastUpdatedAt; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("approverEntraId", this.approverEntraId); + jsonWriter.writeStringField("lastUpdatedAt", + this.lastUpdatedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdatedAt)); + jsonWriter.writeStringField("actionPerformed", + this.actionPerformed == null ? null : this.actionPerformed.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Approver from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Approver if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Approver. + */ + public static Approver fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Approver deserializedApprover = new Approver(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("approverEntraId".equals(fieldName)) { + deserializedApprover.approverEntraId = reader.getString(); + } else if ("lastUpdatedAt".equals(fieldName)) { + deserializedApprover.lastUpdatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("actionPerformed".equals(fieldName)) { + deserializedApprover.actionPerformed = ActionPerformed.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedApprover; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CheckAddressSpaceAvailabilityRequest.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CheckAddressSpaceAvailabilityRequest.java new file mode 100644 index 000000000000..780acb1ae132 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CheckAddressSpaceAvailabilityRequest.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request to the action call to check address space availability. + */ +@Fluent +public final class CheckAddressSpaceAvailabilityRequest + implements JsonSerializable { + /* + * Resource Id of the Community + */ + private String communityResourceId; + + /* + * Information about the enclave virtual network + */ + private EnclaveVirtualNetworkModel enclaveVirtualNetwork; + + /** + * Creates an instance of CheckAddressSpaceAvailabilityRequest class. + */ + public CheckAddressSpaceAvailabilityRequest() { + } + + /** + * Get the communityResourceId property: Resource Id of the Community. + * + * @return the communityResourceId value. + */ + public String communityResourceId() { + return this.communityResourceId; + } + + /** + * Set the communityResourceId property: Resource Id of the Community. + * + * @param communityResourceId the communityResourceId value to set. + * @return the CheckAddressSpaceAvailabilityRequest object itself. + */ + public CheckAddressSpaceAvailabilityRequest withCommunityResourceId(String communityResourceId) { + this.communityResourceId = communityResourceId; + return this; + } + + /** + * Get the enclaveVirtualNetwork property: Information about the enclave virtual network. + * + * @return the enclaveVirtualNetwork value. + */ + public EnclaveVirtualNetworkModel enclaveVirtualNetwork() { + return this.enclaveVirtualNetwork; + } + + /** + * Set the enclaveVirtualNetwork property: Information about the enclave virtual network. + * + * @param enclaveVirtualNetwork the enclaveVirtualNetwork value to set. + * @return the CheckAddressSpaceAvailabilityRequest object itself. + */ + public CheckAddressSpaceAvailabilityRequest + withEnclaveVirtualNetwork(EnclaveVirtualNetworkModel enclaveVirtualNetwork) { + this.enclaveVirtualNetwork = enclaveVirtualNetwork; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("communityResourceId", this.communityResourceId); + jsonWriter.writeJsonField("enclaveVirtualNetwork", this.enclaveVirtualNetwork); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckAddressSpaceAvailabilityRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckAddressSpaceAvailabilityRequest if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CheckAddressSpaceAvailabilityRequest. + */ + public static CheckAddressSpaceAvailabilityRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckAddressSpaceAvailabilityRequest deserializedCheckAddressSpaceAvailabilityRequest + = new CheckAddressSpaceAvailabilityRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("communityResourceId".equals(fieldName)) { + deserializedCheckAddressSpaceAvailabilityRequest.communityResourceId = reader.getString(); + } else if ("enclaveVirtualNetwork".equals(fieldName)) { + deserializedCheckAddressSpaceAvailabilityRequest.enclaveVirtualNetwork + = EnclaveVirtualNetworkModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckAddressSpaceAvailabilityRequest; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CheckAddressSpaceAvailabilityResponse.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CheckAddressSpaceAvailabilityResponse.java new file mode 100644 index 000000000000..909da566b905 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CheckAddressSpaceAvailabilityResponse.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.resourcemanager.virtualenclaves.fluent.models.CheckAddressSpaceAvailabilityResponseInner; + +/** + * An immutable client-side representation of CheckAddressSpaceAvailabilityResponse. + */ +public interface CheckAddressSpaceAvailabilityResponse { + /** + * Gets the value property: Boolean representing whether the address space is available. + * + * @return the value value. + */ + boolean value(); + + /** + * Gets the inner com.azure.resourcemanager.virtualenclaves.fluent.models.CheckAddressSpaceAvailabilityResponseInner + * object. + * + * @return the inner object. + */ + CheckAddressSpaceAvailabilityResponseInner innerModel(); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Communities.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Communities.java new file mode 100644 index 000000000000..6a5e1fbdf3fa --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Communities.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Communities. + */ +public interface Communities { + /** + * Get a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String communityName, + Context context); + + /** + * Get a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityResource. + */ + CommunityResource getByResourceGroup(String resourceGroupName, String communityName); + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String communityName); + + /** + * Delete a CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String communityName, Context context); + + /** + * List CommunityResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List CommunityResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List CommunityResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List CommunityResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Checks that the IP Address Space to be allocated for this Community is available. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param checkAddressSpaceAvailabilityRequest Check IP Address Space request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of availability of the requested address space along with {@link Response}. + */ + Response checkAddressSpaceAvailabilityWithResponse(String resourceGroupName, + String communityName, CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest, + Context context); + + /** + * Checks that the IP Address Space to be allocated for this Community is available. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param checkAddressSpaceAvailabilityRequest Check IP Address Space request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of availability of the requested address space. + */ + CheckAddressSpaceAvailabilityResponse checkAddressSpaceAvailability(String resourceGroupName, String communityName, + CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest); + + /** + * Get a CommunityResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityResource along with {@link Response}. + */ + CommunityResource getById(String id); + + /** + * Get a CommunityResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a CommunityResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a CommunityResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CommunityResource resource. + * + * @param name resource name. + * @return the first stage of the new CommunityResource definition. + */ + CommunityResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointDestinationRule.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointDestinationRule.java new file mode 100644 index 000000000000..74dc133d1b64 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointDestinationRule.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Base type for destination rules. + */ +@Fluent +public final class CommunityEndpointDestinationRule implements JsonSerializable { + /* + * Destination Type. + */ + private DestinationType destinationType; + + /* + * Protocols. Options specified by Endpoint Protocol Enum. + */ + private List protocols; + + /* + * Transit Hub Resource Id. + */ + private String transitHubResourceId; + + /* + * Endpoint Rule Name. + */ + private String endpointRuleName; + + /* + * Destination address. Can include multiple CIDR/IP Addresses or fqdn tags or fqdns (for community endpoint) + * separated by commas. + */ + private String destination; + + /* + * Port. Can include multiple ports separated by commas or a range indicated by a hyphen. + */ + private String ports; + + /** + * Creates an instance of CommunityEndpointDestinationRule class. + */ + public CommunityEndpointDestinationRule() { + } + + /** + * Get the destinationType property: Destination Type. + * + * @return the destinationType value. + */ + public DestinationType destinationType() { + return this.destinationType; + } + + /** + * Set the destinationType property: Destination Type. + * + * @param destinationType the destinationType value to set. + * @return the CommunityEndpointDestinationRule object itself. + */ + public CommunityEndpointDestinationRule withDestinationType(DestinationType destinationType) { + this.destinationType = destinationType; + return this; + } + + /** + * Get the protocols property: Protocols. Options specified by Endpoint Protocol Enum. + * + * @return the protocols value. + */ + public List protocols() { + return this.protocols; + } + + /** + * Set the protocols property: Protocols. Options specified by Endpoint Protocol Enum. + * + * @param protocols the protocols value to set. + * @return the CommunityEndpointDestinationRule object itself. + */ + public CommunityEndpointDestinationRule withProtocols(List protocols) { + this.protocols = protocols; + return this; + } + + /** + * Get the transitHubResourceId property: Transit Hub Resource Id. + * + * @return the transitHubResourceId value. + */ + public String transitHubResourceId() { + return this.transitHubResourceId; + } + + /** + * Set the transitHubResourceId property: Transit Hub Resource Id. + * + * @param transitHubResourceId the transitHubResourceId value to set. + * @return the CommunityEndpointDestinationRule object itself. + */ + public CommunityEndpointDestinationRule withTransitHubResourceId(String transitHubResourceId) { + this.transitHubResourceId = transitHubResourceId; + return this; + } + + /** + * Get the endpointRuleName property: Endpoint Rule Name. + * + * @return the endpointRuleName value. + */ + public String endpointRuleName() { + return this.endpointRuleName; + } + + /** + * Set the endpointRuleName property: Endpoint Rule Name. + * + * @param endpointRuleName the endpointRuleName value to set. + * @return the CommunityEndpointDestinationRule object itself. + */ + public CommunityEndpointDestinationRule withEndpointRuleName(String endpointRuleName) { + this.endpointRuleName = endpointRuleName; + return this; + } + + /** + * Get the destination property: Destination address. Can include multiple CIDR/IP Addresses or fqdn tags or fqdns + * (for community endpoint) separated by commas. + * + * @return the destination value. + */ + public String destination() { + return this.destination; + } + + /** + * Set the destination property: Destination address. Can include multiple CIDR/IP Addresses or fqdn tags or fqdns + * (for community endpoint) separated by commas. + * + * @param destination the destination value to set. + * @return the CommunityEndpointDestinationRule object itself. + */ + public CommunityEndpointDestinationRule withDestination(String destination) { + this.destination = destination; + return this; + } + + /** + * Get the ports property: Port. Can include multiple ports separated by commas or a range indicated by a hyphen. + * + * @return the ports value. + */ + public String ports() { + return this.ports; + } + + /** + * Set the ports property: Port. Can include multiple ports separated by commas or a range indicated by a hyphen. + * + * @param ports the ports value to set. + * @return the CommunityEndpointDestinationRule object itself. + */ + public CommunityEndpointDestinationRule withPorts(String ports) { + this.ports = ports; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("destinationType", + this.destinationType == null ? null : this.destinationType.toString()); + jsonWriter.writeArrayField("protocols", this.protocols, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("transitHubResourceId", this.transitHubResourceId); + jsonWriter.writeStringField("endpointRuleName", this.endpointRuleName); + jsonWriter.writeStringField("destination", this.destination); + jsonWriter.writeStringField("ports", this.ports); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunityEndpointDestinationRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityEndpointDestinationRule if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CommunityEndpointDestinationRule. + */ + public static CommunityEndpointDestinationRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityEndpointDestinationRule deserializedCommunityEndpointDestinationRule + = new CommunityEndpointDestinationRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("destinationType".equals(fieldName)) { + deserializedCommunityEndpointDestinationRule.destinationType + = DestinationType.fromString(reader.getString()); + } else if ("protocols".equals(fieldName)) { + List protocols + = reader.readArray(reader1 -> CommunityEndpointProtocol.fromString(reader1.getString())); + deserializedCommunityEndpointDestinationRule.protocols = protocols; + } else if ("transitHubResourceId".equals(fieldName)) { + deserializedCommunityEndpointDestinationRule.transitHubResourceId = reader.getString(); + } else if ("endpointRuleName".equals(fieldName)) { + deserializedCommunityEndpointDestinationRule.endpointRuleName = reader.getString(); + } else if ("destination".equals(fieldName)) { + deserializedCommunityEndpointDestinationRule.destination = reader.getString(); + } else if ("ports".equals(fieldName)) { + deserializedCommunityEndpointDestinationRule.ports = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityEndpointDestinationRule; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointPatchModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointPatchModel.java new file mode 100644 index 000000000000..82bc33851514 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointPatchModel.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Community Endpoint Patch Resource. + */ +@Fluent +public final class CommunityEndpointPatchModel implements JsonSerializable { + /* + * Community Endpoint Patch properties + */ + private CommunityEndpointPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of CommunityEndpointPatchModel class. + */ + public CommunityEndpointPatchModel() { + } + + /** + * Get the properties property: Community Endpoint Patch properties. + * + * @return the properties value. + */ + public CommunityEndpointPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Community Endpoint Patch properties. + * + * @param properties the properties value to set. + * @return the CommunityEndpointPatchModel object itself. + */ + public CommunityEndpointPatchModel withProperties(CommunityEndpointPatchProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the CommunityEndpointPatchModel object itself. + */ + public CommunityEndpointPatchModel withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunityEndpointPatchModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityEndpointPatchModel if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CommunityEndpointPatchModel. + */ + public static CommunityEndpointPatchModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityEndpointPatchModel deserializedCommunityEndpointPatchModel = new CommunityEndpointPatchModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedCommunityEndpointPatchModel.properties + = CommunityEndpointPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCommunityEndpointPatchModel.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityEndpointPatchModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointPatchProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointPatchProperties.java new file mode 100644 index 000000000000..a6d9df22cab7 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointPatchProperties.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Community Endpoint patchable Properties. + */ +@Fluent +public final class CommunityEndpointPatchProperties implements JsonSerializable { + /* + * Community Endpoint Rule Collection. + */ + private List ruleCollection; + + /** + * Creates an instance of CommunityEndpointPatchProperties class. + */ + public CommunityEndpointPatchProperties() { + } + + /** + * Get the ruleCollection property: Community Endpoint Rule Collection. + * + * @return the ruleCollection value. + */ + public List ruleCollection() { + return this.ruleCollection; + } + + /** + * Set the ruleCollection property: Community Endpoint Rule Collection. + * + * @param ruleCollection the ruleCollection value to set. + * @return the CommunityEndpointPatchProperties object itself. + */ + public CommunityEndpointPatchProperties withRuleCollection(List ruleCollection) { + this.ruleCollection = ruleCollection; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ruleCollection", this.ruleCollection, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunityEndpointPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityEndpointPatchProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CommunityEndpointPatchProperties. + */ + public static CommunityEndpointPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityEndpointPatchProperties deserializedCommunityEndpointPatchProperties + = new CommunityEndpointPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ruleCollection".equals(fieldName)) { + List ruleCollection + = reader.readArray(reader1 -> CommunityEndpointDestinationRule.fromJson(reader1)); + deserializedCommunityEndpointPatchProperties.ruleCollection = ruleCollection; + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityEndpointPatchProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointProperties.java new file mode 100644 index 000000000000..3c557236a6ed --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointProperties.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Community Endpoint Resource properties. + */ +@Fluent +public final class CommunityEndpointProperties implements JsonSerializable { + /* + * Community Endpoint Rule Collection. + */ + private List ruleCollection; + + /* + * List of resource ids created by community endpoint. + */ + private List resourceCollection; + + /* + * Provisioning State. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of CommunityEndpointProperties class. + */ + public CommunityEndpointProperties() { + } + + /** + * Get the ruleCollection property: Community Endpoint Rule Collection. + * + * @return the ruleCollection value. + */ + public List ruleCollection() { + return this.ruleCollection; + } + + /** + * Set the ruleCollection property: Community Endpoint Rule Collection. + * + * @param ruleCollection the ruleCollection value to set. + * @return the CommunityEndpointProperties object itself. + */ + public CommunityEndpointProperties withRuleCollection(List ruleCollection) { + this.ruleCollection = ruleCollection; + return this; + } + + /** + * Get the resourceCollection property: List of resource ids created by community endpoint. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.resourceCollection; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ruleCollection", this.ruleCollection, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunityEndpointProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityEndpointProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CommunityEndpointProperties. + */ + public static CommunityEndpointProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityEndpointProperties deserializedCommunityEndpointProperties = new CommunityEndpointProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ruleCollection".equals(fieldName)) { + List ruleCollection + = reader.readArray(reader1 -> CommunityEndpointDestinationRule.fromJson(reader1)); + deserializedCommunityEndpointProperties.ruleCollection = ruleCollection; + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedCommunityEndpointProperties.resourceCollection = resourceCollection; + } else if ("provisioningState".equals(fieldName)) { + deserializedCommunityEndpointProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityEndpointProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointProtocol.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointProtocol.java new file mode 100644 index 000000000000..7007ff6bbb92 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointProtocol.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Community Endpoint Protocol Enum. + */ +public final class CommunityEndpointProtocol extends ExpandableStringEnum { + /** + * CommunityEndpointProtocol Type ANY. + */ + public static final CommunityEndpointProtocol ANY = fromString("ANY"); + + /** + * CommunityEndpointProtocol Type TCP. + */ + public static final CommunityEndpointProtocol TCP = fromString("TCP"); + + /** + * CommunityEndpointProtocol Type UDP. + */ + public static final CommunityEndpointProtocol UDP = fromString("UDP"); + + /** + * CommunityEndpointProtocol Type ICMP. + */ + public static final CommunityEndpointProtocol ICMP = fromString("ICMP"); + + /** + * CommunityEndpointProtocol Type ESP. + */ + public static final CommunityEndpointProtocol ESP = fromString("ESP"); + + /** + * CommunityEndpointProtocol Type AH. + */ + public static final CommunityEndpointProtocol AH = fromString("AH"); + + /** + * CommunityEndpointProtocol Type HTTPS. + */ + public static final CommunityEndpointProtocol HTTPS = fromString("HTTPS"); + + /** + * CommunityEndpointProtocol Type HTTP. + */ + public static final CommunityEndpointProtocol HTTP = fromString("HTTP"); + + /** + * Creates a new instance of CommunityEndpointProtocol value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CommunityEndpointProtocol() { + } + + /** + * Creates or finds a CommunityEndpointProtocol from its string representation. + * + * @param name a name to look for. + * @return the corresponding CommunityEndpointProtocol. + */ + public static CommunityEndpointProtocol fromString(String name) { + return fromString(name, CommunityEndpointProtocol.class); + } + + /** + * Gets known CommunityEndpointProtocol values. + * + * @return known CommunityEndpointProtocol values. + */ + public static Collection values() { + return values(CommunityEndpointProtocol.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointResource.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointResource.java new file mode 100644 index 000000000000..9657364f29d4 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointResource.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityEndpointResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of CommunityEndpointResource. + */ +public interface CommunityEndpointResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + CommunityEndpointProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityEndpointResourceInner object. + * + * @return the inner object. + */ + CommunityEndpointResourceInner innerModel(); + + /** + * The entirety of the CommunityEndpointResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The CommunityEndpointResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CommunityEndpointResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the CommunityEndpointResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the CommunityEndpointResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, communityName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @return the next definition stage. + */ + WithCreate withExistingCommunity(String resourceGroupName, String communityName); + } + + /** + * The stage of the CommunityEndpointResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + CommunityEndpointResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CommunityEndpointResource create(Context context); + } + + /** + * The stage of the CommunityEndpointResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the CommunityEndpointResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(CommunityEndpointProperties properties); + } + } + + /** + * Begins update for the CommunityEndpointResource resource. + * + * @return the stage of resource update. + */ + CommunityEndpointResource.Update update(); + + /** + * The template for CommunityEndpointResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CommunityEndpointResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CommunityEndpointResource apply(Context context); + } + + /** + * The CommunityEndpointResource update stages. + */ + interface UpdateStages { + /** + * The stage of the CommunityEndpointResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the CommunityEndpointResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Community Endpoint Patch properties. + * + * @param properties Community Endpoint Patch properties. + * @return the next definition stage. + */ + Update withProperties(CommunityEndpointPatchProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CommunityEndpointResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CommunityEndpointResource refresh(Context context); + + /** + * Callback that triggers on approval state change. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpoints.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpoints.java new file mode 100644 index 000000000000..d67707ee2c05 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpoints.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CommunityEndpoints. + */ +public interface CommunityEndpoints { + /** + * Get a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityEndpointResource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String communityName, + String communityEndpointName, Context context); + + /** + * Get a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityEndpointResource. + */ + CommunityEndpointResource get(String resourceGroupName, String communityName, String communityEndpointName); + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String communityName, String communityEndpointName); + + /** + * Delete a CommunityEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String communityName, String communityEndpointName, Context context); + + /** + * List CommunityEndpointResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByCommunityResource(String resourceGroupName, String communityName); + + /** + * List CommunityEndpointResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByCommunityResource(String resourceGroupName, String communityName, + Context context); + + /** + * List CommunityEndpointResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listBySubscription(String communityName); + + /** + * List CommunityEndpointResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CommunityEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listBySubscription(String communityName, Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param communityEndpointName The name of the Community Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body, Context context); + + /** + * Get a CommunityEndpointResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityEndpointResource along with {@link Response}. + */ + CommunityEndpointResource getById(String id); + + /** + * Get a CommunityEndpointResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a CommunityEndpointResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a CommunityEndpointResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a CommunityEndpointResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CommunityEndpointResource resource. + * + * @param name resource name. + * @return the first stage of the new CommunityEndpointResource definition. + */ + CommunityEndpointResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPatchModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPatchModel.java new file mode 100644 index 000000000000..be6504875467 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPatchModel.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Community Patch Resource. + */ +@Fluent +public final class CommunityPatchModel implements JsonSerializable { + /* + * Community Patch properties + */ + private CommunityPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /** + * Creates an instance of CommunityPatchModel class. + */ + public CommunityPatchModel() { + } + + /** + * Get the properties property: Community Patch properties. + * + * @return the properties value. + */ + public CommunityPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Community Patch properties. + * + * @param properties the properties value to set. + * @return the CommunityPatchModel object itself. + */ + public CommunityPatchModel withProperties(CommunityPatchProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the CommunityPatchModel object itself. + */ + public CommunityPatchModel withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the CommunityPatchModel object itself. + */ + public CommunityPatchModel withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunityPatchModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityPatchModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CommunityPatchModel. + */ + public static CommunityPatchModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityPatchModel deserializedCommunityPatchModel = new CommunityPatchModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedCommunityPatchModel.properties = CommunityPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCommunityPatchModel.tags = tags; + } else if ("identity".equals(fieldName)) { + deserializedCommunityPatchModel.identity = ManagedServiceIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityPatchModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPatchProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPatchProperties.java new file mode 100644 index 000000000000..4209c206645b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPatchProperties.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Community Resource Properties without default values. + */ +@Fluent +public final class CommunityPatchProperties implements JsonSerializable { + /* + * DNS Servers. + */ + private List dnsServers; + + /* + * List of services governed by a community. + */ + private List governedServiceList; + + /* + * Policy override setting for the community. Specifies whether to apply enclave-specific policies or disable policy + * enforcement. + */ + private CommunityPropertiesPolicyOverride policyOverride; + + /* + * Community role assignments + */ + private List communityRoleAssignments; + + /* + * SKU of the community's Azure Firewall (Basic, Standard, Premium). Standard is the default + */ + private FirewallSKU firewallSku; + + /* + * Approval requirements for various actions on the community's resources. + */ + private ApprovalSettingsPatchProperties approvalSettings; + + /* + * Maintenance Mode configuration. + */ + private MaintenanceModeConfigurationPatchModel maintenanceModeConfiguration; + + /** + * Creates an instance of CommunityPatchProperties class. + */ + public CommunityPatchProperties() { + } + + /** + * Get the dnsServers property: DNS Servers. + * + * @return the dnsServers value. + */ + public List dnsServers() { + return this.dnsServers; + } + + /** + * Set the dnsServers property: DNS Servers. + * + * @param dnsServers the dnsServers value to set. + * @return the CommunityPatchProperties object itself. + */ + public CommunityPatchProperties withDnsServers(List dnsServers) { + this.dnsServers = dnsServers; + return this; + } + + /** + * Get the governedServiceList property: List of services governed by a community. + * + * @return the governedServiceList value. + */ + public List governedServiceList() { + return this.governedServiceList; + } + + /** + * Set the governedServiceList property: List of services governed by a community. + * + * @param governedServiceList the governedServiceList value to set. + * @return the CommunityPatchProperties object itself. + */ + public CommunityPatchProperties withGovernedServiceList(List governedServiceList) { + this.governedServiceList = governedServiceList; + return this; + } + + /** + * Get the policyOverride property: Policy override setting for the community. Specifies whether to apply + * enclave-specific policies or disable policy enforcement. + * + * @return the policyOverride value. + */ + public CommunityPropertiesPolicyOverride policyOverride() { + return this.policyOverride; + } + + /** + * Set the policyOverride property: Policy override setting for the community. Specifies whether to apply + * enclave-specific policies or disable policy enforcement. + * + * @param policyOverride the policyOverride value to set. + * @return the CommunityPatchProperties object itself. + */ + public CommunityPatchProperties withPolicyOverride(CommunityPropertiesPolicyOverride policyOverride) { + this.policyOverride = policyOverride; + return this; + } + + /** + * Get the communityRoleAssignments property: Community role assignments. + * + * @return the communityRoleAssignments value. + */ + public List communityRoleAssignments() { + return this.communityRoleAssignments; + } + + /** + * Set the communityRoleAssignments property: Community role assignments. + * + * @param communityRoleAssignments the communityRoleAssignments value to set. + * @return the CommunityPatchProperties object itself. + */ + public CommunityPatchProperties withCommunityRoleAssignments(List communityRoleAssignments) { + this.communityRoleAssignments = communityRoleAssignments; + return this; + } + + /** + * Get the firewallSku property: SKU of the community's Azure Firewall (Basic, Standard, Premium). Standard is the + * default. + * + * @return the firewallSku value. + */ + public FirewallSKU firewallSku() { + return this.firewallSku; + } + + /** + * Set the firewallSku property: SKU of the community's Azure Firewall (Basic, Standard, Premium). Standard is the + * default. + * + * @param firewallSku the firewallSku value to set. + * @return the CommunityPatchProperties object itself. + */ + public CommunityPatchProperties withFirewallSku(FirewallSKU firewallSku) { + this.firewallSku = firewallSku; + return this; + } + + /** + * Get the approvalSettings property: Approval requirements for various actions on the community's resources. + * + * @return the approvalSettings value. + */ + public ApprovalSettingsPatchProperties approvalSettings() { + return this.approvalSettings; + } + + /** + * Set the approvalSettings property: Approval requirements for various actions on the community's resources. + * + * @param approvalSettings the approvalSettings value to set. + * @return the CommunityPatchProperties object itself. + */ + public CommunityPatchProperties withApprovalSettings(ApprovalSettingsPatchProperties approvalSettings) { + this.approvalSettings = approvalSettings; + return this; + } + + /** + * Get the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @return the maintenanceModeConfiguration value. + */ + public MaintenanceModeConfigurationPatchModel maintenanceModeConfiguration() { + return this.maintenanceModeConfiguration; + } + + /** + * Set the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @param maintenanceModeConfiguration the maintenanceModeConfiguration value to set. + * @return the CommunityPatchProperties object itself. + */ + public CommunityPatchProperties + withMaintenanceModeConfiguration(MaintenanceModeConfigurationPatchModel maintenanceModeConfiguration) { + this.maintenanceModeConfiguration = maintenanceModeConfiguration; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("dnsServers", this.dnsServers, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("governedServiceList", this.governedServiceList, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("policyOverride", + this.policyOverride == null ? null : this.policyOverride.toString()); + jsonWriter.writeArrayField("communityRoleAssignments", this.communityRoleAssignments, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("firewallSku", this.firewallSku == null ? null : this.firewallSku.toString()); + jsonWriter.writeJsonField("approvalSettings", this.approvalSettings); + jsonWriter.writeJsonField("maintenanceModeConfiguration", this.maintenanceModeConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunityPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityPatchProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CommunityPatchProperties. + */ + public static CommunityPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityPatchProperties deserializedCommunityPatchProperties = new CommunityPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dnsServers".equals(fieldName)) { + List dnsServers = reader.readArray(reader1 -> reader1.getString()); + deserializedCommunityPatchProperties.dnsServers = dnsServers; + } else if ("governedServiceList".equals(fieldName)) { + List governedServiceList + = reader.readArray(reader1 -> GovernedServiceItem.fromJson(reader1)); + deserializedCommunityPatchProperties.governedServiceList = governedServiceList; + } else if ("policyOverride".equals(fieldName)) { + deserializedCommunityPatchProperties.policyOverride + = CommunityPropertiesPolicyOverride.fromString(reader.getString()); + } else if ("communityRoleAssignments".equals(fieldName)) { + List communityRoleAssignments + = reader.readArray(reader1 -> RoleAssignmentItem.fromJson(reader1)); + deserializedCommunityPatchProperties.communityRoleAssignments = communityRoleAssignments; + } else if ("firewallSku".equals(fieldName)) { + deserializedCommunityPatchProperties.firewallSku = FirewallSKU.fromString(reader.getString()); + } else if ("approvalSettings".equals(fieldName)) { + deserializedCommunityPatchProperties.approvalSettings + = ApprovalSettingsPatchProperties.fromJson(reader); + } else if ("maintenanceModeConfiguration".equals(fieldName)) { + deserializedCommunityPatchProperties.maintenanceModeConfiguration + = MaintenanceModeConfigurationPatchModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityPatchProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityProperties.java new file mode 100644 index 000000000000..1321f775fffa --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityProperties.java @@ -0,0 +1,365 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Community Resource Properties. + */ +@Fluent +public final class CommunityProperties implements JsonSerializable { + /* + * Address Space. + */ + private String addressSpace; + + /* + * DNS Servers. + */ + private List dnsServers; + + /* + * Provisioning State. + */ + private ProvisioningState provisioningState; + + /* + * List of resource ids created by communities. + */ + private List resourceCollection; + + /* + * Managed resource group name. + */ + private String managedResourceGroupName; + + /* + * Managed On Behalf Of Configuration. + */ + private ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration; + + /* + * List of services governed by a community. + */ + private List governedServiceList; + + /* + * Policy override setting for the community. Specifies whether to apply enclave-specific policies or disable policy + * enforcement. + */ + private CommunityPropertiesPolicyOverride policyOverride; + + /* + * Community role assignments + */ + private List communityRoleAssignments; + + /* + * SKU of the community's Azure Firewall (Basic, Standard, Premium). Standard is the default + */ + private FirewallSKU firewallSku; + + /* + * Approval requirements for various actions on the community's resources. + */ + private ApprovalSettings approvalSettings; + + /* + * Maintenance Mode configuration. + */ + private MaintenanceModeConfigurationModel maintenanceModeConfiguration; + + /** + * Creates an instance of CommunityProperties class. + */ + public CommunityProperties() { + } + + /** + * Get the addressSpace property: Address Space. + * + * @return the addressSpace value. + */ + public String addressSpace() { + return this.addressSpace; + } + + /** + * Set the addressSpace property: Address Space. + * + * @param addressSpace the addressSpace value to set. + * @return the CommunityProperties object itself. + */ + public CommunityProperties withAddressSpace(String addressSpace) { + this.addressSpace = addressSpace; + return this; + } + + /** + * Get the dnsServers property: DNS Servers. + * + * @return the dnsServers value. + */ + public List dnsServers() { + return this.dnsServers; + } + + /** + * Set the dnsServers property: DNS Servers. + * + * @param dnsServers the dnsServers value to set. + * @return the CommunityProperties object itself. + */ + public CommunityProperties withDnsServers(List dnsServers) { + this.dnsServers = dnsServers; + return this; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the resourceCollection property: List of resource ids created by communities. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.resourceCollection; + } + + /** + * Get the managedResourceGroupName property: Managed resource group name. + * + * @return the managedResourceGroupName value. + */ + public String managedResourceGroupName() { + return this.managedResourceGroupName; + } + + /** + * Get the managedOnBehalfOfConfiguration property: Managed On Behalf Of Configuration. + * + * @return the managedOnBehalfOfConfiguration value. + */ + public ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration() { + return this.managedOnBehalfOfConfiguration; + } + + /** + * Get the governedServiceList property: List of services governed by a community. + * + * @return the governedServiceList value. + */ + public List governedServiceList() { + return this.governedServiceList; + } + + /** + * Set the governedServiceList property: List of services governed by a community. + * + * @param governedServiceList the governedServiceList value to set. + * @return the CommunityProperties object itself. + */ + public CommunityProperties withGovernedServiceList(List governedServiceList) { + this.governedServiceList = governedServiceList; + return this; + } + + /** + * Get the policyOverride property: Policy override setting for the community. Specifies whether to apply + * enclave-specific policies or disable policy enforcement. + * + * @return the policyOverride value. + */ + public CommunityPropertiesPolicyOverride policyOverride() { + return this.policyOverride; + } + + /** + * Set the policyOverride property: Policy override setting for the community. Specifies whether to apply + * enclave-specific policies or disable policy enforcement. + * + * @param policyOverride the policyOverride value to set. + * @return the CommunityProperties object itself. + */ + public CommunityProperties withPolicyOverride(CommunityPropertiesPolicyOverride policyOverride) { + this.policyOverride = policyOverride; + return this; + } + + /** + * Get the communityRoleAssignments property: Community role assignments. + * + * @return the communityRoleAssignments value. + */ + public List communityRoleAssignments() { + return this.communityRoleAssignments; + } + + /** + * Set the communityRoleAssignments property: Community role assignments. + * + * @param communityRoleAssignments the communityRoleAssignments value to set. + * @return the CommunityProperties object itself. + */ + public CommunityProperties withCommunityRoleAssignments(List communityRoleAssignments) { + this.communityRoleAssignments = communityRoleAssignments; + return this; + } + + /** + * Get the firewallSku property: SKU of the community's Azure Firewall (Basic, Standard, Premium). Standard is the + * default. + * + * @return the firewallSku value. + */ + public FirewallSKU firewallSku() { + return this.firewallSku; + } + + /** + * Set the firewallSku property: SKU of the community's Azure Firewall (Basic, Standard, Premium). Standard is the + * default. + * + * @param firewallSku the firewallSku value to set. + * @return the CommunityProperties object itself. + */ + public CommunityProperties withFirewallSku(FirewallSKU firewallSku) { + this.firewallSku = firewallSku; + return this; + } + + /** + * Get the approvalSettings property: Approval requirements for various actions on the community's resources. + * + * @return the approvalSettings value. + */ + public ApprovalSettings approvalSettings() { + return this.approvalSettings; + } + + /** + * Set the approvalSettings property: Approval requirements for various actions on the community's resources. + * + * @param approvalSettings the approvalSettings value to set. + * @return the CommunityProperties object itself. + */ + public CommunityProperties withApprovalSettings(ApprovalSettings approvalSettings) { + this.approvalSettings = approvalSettings; + return this; + } + + /** + * Get the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @return the maintenanceModeConfiguration value. + */ + public MaintenanceModeConfigurationModel maintenanceModeConfiguration() { + return this.maintenanceModeConfiguration; + } + + /** + * Set the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @param maintenanceModeConfiguration the maintenanceModeConfiguration value to set. + * @return the CommunityProperties object itself. + */ + public CommunityProperties + withMaintenanceModeConfiguration(MaintenanceModeConfigurationModel maintenanceModeConfiguration) { + this.maintenanceModeConfiguration = maintenanceModeConfiguration; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("addressSpace", this.addressSpace); + jsonWriter.writeArrayField("dnsServers", this.dnsServers, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("governedServiceList", this.governedServiceList, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("policyOverride", + this.policyOverride == null ? null : this.policyOverride.toString()); + jsonWriter.writeArrayField("communityRoleAssignments", this.communityRoleAssignments, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("firewallSku", this.firewallSku == null ? null : this.firewallSku.toString()); + jsonWriter.writeJsonField("approvalSettings", this.approvalSettings); + jsonWriter.writeJsonField("maintenanceModeConfiguration", this.maintenanceModeConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CommunityProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the CommunityProperties. + */ + public static CommunityProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityProperties deserializedCommunityProperties = new CommunityProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("addressSpace".equals(fieldName)) { + deserializedCommunityProperties.addressSpace = reader.getString(); + } else if ("dnsServers".equals(fieldName)) { + List dnsServers = reader.readArray(reader1 -> reader1.getString()); + deserializedCommunityProperties.dnsServers = dnsServers; + } else if ("provisioningState".equals(fieldName)) { + deserializedCommunityProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedCommunityProperties.resourceCollection = resourceCollection; + } else if ("managedResourceGroupName".equals(fieldName)) { + deserializedCommunityProperties.managedResourceGroupName = reader.getString(); + } else if ("managedOnBehalfOfConfiguration".equals(fieldName)) { + deserializedCommunityProperties.managedOnBehalfOfConfiguration + = ManagedOnBehalfOfConfiguration.fromJson(reader); + } else if ("governedServiceList".equals(fieldName)) { + List governedServiceList + = reader.readArray(reader1 -> GovernedServiceItem.fromJson(reader1)); + deserializedCommunityProperties.governedServiceList = governedServiceList; + } else if ("policyOverride".equals(fieldName)) { + deserializedCommunityProperties.policyOverride + = CommunityPropertiesPolicyOverride.fromString(reader.getString()); + } else if ("communityRoleAssignments".equals(fieldName)) { + List communityRoleAssignments + = reader.readArray(reader1 -> RoleAssignmentItem.fromJson(reader1)); + deserializedCommunityProperties.communityRoleAssignments = communityRoleAssignments; + } else if ("firewallSku".equals(fieldName)) { + deserializedCommunityProperties.firewallSku = FirewallSKU.fromString(reader.getString()); + } else if ("approvalSettings".equals(fieldName)) { + deserializedCommunityProperties.approvalSettings = ApprovalSettings.fromJson(reader); + } else if ("maintenanceModeConfiguration".equals(fieldName)) { + deserializedCommunityProperties.maintenanceModeConfiguration + = MaintenanceModeConfigurationModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPropertiesPolicyOverride.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPropertiesPolicyOverride.java new file mode 100644 index 000000000000..15604a959186 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPropertiesPolicyOverride.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for CommunityPropertiesPolicyOverride. + */ +public final class CommunityPropertiesPolicyOverride extends ExpandableStringEnum { + /** + * Static value Enclave for CommunityPropertiesPolicyOverride. + */ + public static final CommunityPropertiesPolicyOverride ENCLAVE = fromString("Enclave"); + + /** + * Static value None for CommunityPropertiesPolicyOverride. + */ + public static final CommunityPropertiesPolicyOverride NONE = fromString("None"); + + /** + * Creates a new instance of CommunityPropertiesPolicyOverride value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CommunityPropertiesPolicyOverride() { + } + + /** + * Creates or finds a CommunityPropertiesPolicyOverride from its string representation. + * + * @param name a name to look for. + * @return the corresponding CommunityPropertiesPolicyOverride. + */ + public static CommunityPropertiesPolicyOverride fromString(String name) { + return fromString(name, CommunityPropertiesPolicyOverride.class); + } + + /** + * Gets known CommunityPropertiesPolicyOverride values. + * + * @return known CommunityPropertiesPolicyOverride values. + */ + public static Collection values() { + return values(CommunityPropertiesPolicyOverride.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityResource.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityResource.java new file mode 100644 index 000000000000..d3f24abdd4bd --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityResource.java @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of CommunityResource. + */ +public interface CommunityResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + CommunityProperties properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityResourceInner object. + * + * @return the inner object. + */ + CommunityResourceInner innerModel(); + + /** + * The entirety of the CommunityResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The CommunityResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CommunityResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the CommunityResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the CommunityResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the CommunityResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + CommunityResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CommunityResource create(Context context); + } + + /** + * The stage of the CommunityResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the CommunityResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(CommunityProperties properties); + } + + /** + * The stage of the CommunityResource definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Begins update for the CommunityResource resource. + * + * @return the stage of resource update. + */ + CommunityResource.Update update(); + + /** + * The template for CommunityResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CommunityResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CommunityResource apply(Context context); + } + + /** + * The CommunityResource update stages. + */ + interface UpdateStages { + /** + * The stage of the CommunityResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the CommunityResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Community Patch properties. + * + * @param properties Community Patch properties. + * @return the next definition stage. + */ + Update withProperties(CommunityPatchProperties properties); + } + + /** + * The stage of the CommunityResource update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CommunityResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CommunityResource refresh(Context context); + + /** + * Checks that the IP Address Space to be allocated for this Community is available. + * + * @param checkAddressSpaceAvailabilityRequest Check IP Address Space request body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of availability of the requested address space along with {@link Response}. + */ + Response checkAddressSpaceAvailabilityWithResponse( + CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest, Context context); + + /** + * Checks that the IP Address Space to be allocated for this Community is available. + * + * @param checkAddressSpaceAvailabilityRequest Check IP Address Space request body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of availability of the requested address space. + */ + CheckAddressSpaceAvailabilityResponse + checkAddressSpaceAvailability(CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/DestinationType.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/DestinationType.java new file mode 100644 index 000000000000..803446f44639 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/DestinationType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Destination Type Enum. + */ +public final class DestinationType extends ExpandableStringEnum { + /** + * DestinationType Type FQDN. + */ + public static final DestinationType FQDN = fromString("FQDN"); + + /** + * DestinationType Type FQDNTag. + */ + public static final DestinationType FQDNTAG = fromString("FQDNTag"); + + /** + * DestinationType Type IPAddress. + */ + public static final DestinationType IPADDRESS = fromString("IPAddress"); + + /** + * DestinationType Type PrivateNetwork. + */ + public static final DestinationType PRIVATE_NETWORK = fromString("PrivateNetwork"); + + /** + * Creates a new instance of DestinationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DestinationType() { + } + + /** + * Creates or finds a DestinationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding DestinationType. + */ + public static DestinationType fromString(String name) { + return fromString(name, DestinationType.class); + } + + /** + * Gets known DestinationType values. + * + * @return known DestinationType values. + */ + public static Collection values() { + return values(DestinationType.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/DiagnosticDestination.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/DiagnosticDestination.java new file mode 100644 index 000000000000..ce3007fee06b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/DiagnosticDestination.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the destination of where to store diagnostic logs. + */ +public final class DiagnosticDestination extends ExpandableStringEnum { + /** + * DiagnosticDestination Type CommunityOnly. + */ + public static final DiagnosticDestination COMMUNITY_ONLY = fromString("CommunityOnly"); + + /** + * DiagnosticDestination Type EnclaveOnly. + */ + public static final DiagnosticDestination ENCLAVE_ONLY = fromString("EnclaveOnly"); + + /** + * DiagnosticDestination Type Both. + */ + public static final DiagnosticDestination BOTH = fromString("Both"); + + /** + * Creates a new instance of DiagnosticDestination value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DiagnosticDestination() { + } + + /** + * Creates or finds a DiagnosticDestination from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiagnosticDestination. + */ + public static DiagnosticDestination fromString(String name) { + return fromString(name, DiagnosticDestination.class); + } + + /** + * Gets known DiagnosticDestination values. + * + * @return known DiagnosticDestination values. + */ + public static Collection values() { + return values(DiagnosticDestination.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveAddressSpacesModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveAddressSpacesModel.java new file mode 100644 index 000000000000..0b33fff16105 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveAddressSpacesModel.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Enclave Address Spaces. + */ +@Immutable +public final class EnclaveAddressSpacesModel implements JsonSerializable { + /* + * Enclave Address Space + */ + private String enclaveAddressSpace; + + /* + * Managed Address Space + */ + private String managedAddressSpace; + + /** + * Creates an instance of EnclaveAddressSpacesModel class. + */ + private EnclaveAddressSpacesModel() { + } + + /** + * Get the enclaveAddressSpace property: Enclave Address Space. + * + * @return the enclaveAddressSpace value. + */ + public String enclaveAddressSpace() { + return this.enclaveAddressSpace; + } + + /** + * Get the managedAddressSpace property: Managed Address Space. + * + * @return the managedAddressSpace value. + */ + public String managedAddressSpace() { + return this.managedAddressSpace; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("enclaveAddressSpace", this.enclaveAddressSpace); + jsonWriter.writeStringField("managedAddressSpace", this.managedAddressSpace); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveAddressSpacesModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveAddressSpacesModel if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnclaveAddressSpacesModel. + */ + public static EnclaveAddressSpacesModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveAddressSpacesModel deserializedEnclaveAddressSpacesModel = new EnclaveAddressSpacesModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enclaveAddressSpace".equals(fieldName)) { + deserializedEnclaveAddressSpacesModel.enclaveAddressSpace = reader.getString(); + } else if ("managedAddressSpace".equals(fieldName)) { + deserializedEnclaveAddressSpacesModel.managedAddressSpace = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveAddressSpacesModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionPatchModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionPatchModel.java new file mode 100644 index 000000000000..5a7c14516b75 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionPatchModel.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Enclave Connection Patch Resource. + */ +@Fluent +public final class EnclaveConnectionPatchModel implements JsonSerializable { + /* + * Enclave Connection Patch properties + */ + private EnclaveConnectionPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of EnclaveConnectionPatchModel class. + */ + public EnclaveConnectionPatchModel() { + } + + /** + * Get the properties property: Enclave Connection Patch properties. + * + * @return the properties value. + */ + public EnclaveConnectionPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Enclave Connection Patch properties. + * + * @param properties the properties value to set. + * @return the EnclaveConnectionPatchModel object itself. + */ + public EnclaveConnectionPatchModel withProperties(EnclaveConnectionPatchProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the EnclaveConnectionPatchModel object itself. + */ + public EnclaveConnectionPatchModel withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveConnectionPatchModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveConnectionPatchModel if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnclaveConnectionPatchModel. + */ + public static EnclaveConnectionPatchModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveConnectionPatchModel deserializedEnclaveConnectionPatchModel = new EnclaveConnectionPatchModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedEnclaveConnectionPatchModel.properties + = EnclaveConnectionPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEnclaveConnectionPatchModel.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveConnectionPatchModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionPatchProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionPatchProperties.java new file mode 100644 index 000000000000..e0d55f706fc1 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionPatchProperties.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Enclave Connection patchable Properties. + */ +@Fluent +public final class EnclaveConnectionPatchProperties implements JsonSerializable { + /* + * Source CIDR. + */ + private String sourceCidr; + + /** + * Creates an instance of EnclaveConnectionPatchProperties class. + */ + public EnclaveConnectionPatchProperties() { + } + + /** + * Get the sourceCidr property: Source CIDR. + * + * @return the sourceCidr value. + */ + public String sourceCidr() { + return this.sourceCidr; + } + + /** + * Set the sourceCidr property: Source CIDR. + * + * @param sourceCidr the sourceCidr value to set. + * @return the EnclaveConnectionPatchProperties object itself. + */ + public EnclaveConnectionPatchProperties withSourceCidr(String sourceCidr) { + this.sourceCidr = sourceCidr; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceCidr", this.sourceCidr); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveConnectionPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveConnectionPatchProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnclaveConnectionPatchProperties. + */ + public static EnclaveConnectionPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveConnectionPatchProperties deserializedEnclaveConnectionPatchProperties + = new EnclaveConnectionPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceCidr".equals(fieldName)) { + deserializedEnclaveConnectionPatchProperties.sourceCidr = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveConnectionPatchProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionProperties.java new file mode 100644 index 000000000000..07964254bd90 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionProperties.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Enclave Connection Resource properties. + */ +@Fluent +public final class EnclaveConnectionProperties implements JsonSerializable { + /* + * The state of the enclaveConnection. + */ + private EnclaveConnectionState state; + + /* + * Community Resource Id. + */ + private String communityResourceId; + + /* + * Source Resource Id. + */ + private String sourceResourceId; + + /* + * Source CIDR. + */ + private String sourceCidr; + + /* + * Destination Endpoint Resource Id. + */ + private String destinationEndpointId; + + /* + * Provisioning State. + */ + private ProvisioningState provisioningState; + + /* + * List of resource ids modified by enclave Connections. + */ + private List resourceCollection; + + /** + * Creates an instance of EnclaveConnectionProperties class. + */ + public EnclaveConnectionProperties() { + } + + /** + * Get the state property: The state of the enclaveConnection. + * + * @return the state value. + */ + public EnclaveConnectionState state() { + return this.state; + } + + /** + * Get the communityResourceId property: Community Resource Id. + * + * @return the communityResourceId value. + */ + public String communityResourceId() { + return this.communityResourceId; + } + + /** + * Set the communityResourceId property: Community Resource Id. + * + * @param communityResourceId the communityResourceId value to set. + * @return the EnclaveConnectionProperties object itself. + */ + public EnclaveConnectionProperties withCommunityResourceId(String communityResourceId) { + this.communityResourceId = communityResourceId; + return this; + } + + /** + * Get the sourceResourceId property: Source Resource Id. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.sourceResourceId; + } + + /** + * Set the sourceResourceId property: Source Resource Id. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the EnclaveConnectionProperties object itself. + */ + public EnclaveConnectionProperties withSourceResourceId(String sourceResourceId) { + this.sourceResourceId = sourceResourceId; + return this; + } + + /** + * Get the sourceCidr property: Source CIDR. + * + * @return the sourceCidr value. + */ + public String sourceCidr() { + return this.sourceCidr; + } + + /** + * Set the sourceCidr property: Source CIDR. + * + * @param sourceCidr the sourceCidr value to set. + * @return the EnclaveConnectionProperties object itself. + */ + public EnclaveConnectionProperties withSourceCidr(String sourceCidr) { + this.sourceCidr = sourceCidr; + return this; + } + + /** + * Get the destinationEndpointId property: Destination Endpoint Resource Id. + * + * @return the destinationEndpointId value. + */ + public String destinationEndpointId() { + return this.destinationEndpointId; + } + + /** + * Set the destinationEndpointId property: Destination Endpoint Resource Id. + * + * @param destinationEndpointId the destinationEndpointId value to set. + * @return the EnclaveConnectionProperties object itself. + */ + public EnclaveConnectionProperties withDestinationEndpointId(String destinationEndpointId) { + this.destinationEndpointId = destinationEndpointId; + return this; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the resourceCollection property: List of resource ids modified by enclave Connections. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.resourceCollection; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("communityResourceId", this.communityResourceId); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + jsonWriter.writeStringField("destinationEndpointId", this.destinationEndpointId); + jsonWriter.writeStringField("sourceCidr", this.sourceCidr); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveConnectionProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnclaveConnectionProperties. + */ + public static EnclaveConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveConnectionProperties deserializedEnclaveConnectionProperties = new EnclaveConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("communityResourceId".equals(fieldName)) { + deserializedEnclaveConnectionProperties.communityResourceId = reader.getString(); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedEnclaveConnectionProperties.sourceResourceId = reader.getString(); + } else if ("destinationEndpointId".equals(fieldName)) { + deserializedEnclaveConnectionProperties.destinationEndpointId = reader.getString(); + } else if ("state".equals(fieldName)) { + deserializedEnclaveConnectionProperties.state + = EnclaveConnectionState.fromString(reader.getString()); + } else if ("sourceCidr".equals(fieldName)) { + deserializedEnclaveConnectionProperties.sourceCidr = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedEnclaveConnectionProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedEnclaveConnectionProperties.resourceCollection = resourceCollection; + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveConnectionProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionResource.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionResource.java new file mode 100644 index 000000000000..7e5ee835d486 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionResource.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveConnectionResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of EnclaveConnectionResource. + */ +public interface EnclaveConnectionResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + EnclaveConnectionProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveConnectionResourceInner object. + * + * @return the inner object. + */ + EnclaveConnectionResourceInner innerModel(); + + /** + * The entirety of the EnclaveConnectionResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The EnclaveConnectionResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the EnclaveConnectionResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the EnclaveConnectionResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the EnclaveConnectionResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the EnclaveConnectionResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + EnclaveConnectionResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + EnclaveConnectionResource create(Context context); + } + + /** + * The stage of the EnclaveConnectionResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the EnclaveConnectionResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(EnclaveConnectionProperties properties); + } + } + + /** + * Begins update for the EnclaveConnectionResource resource. + * + * @return the stage of resource update. + */ + EnclaveConnectionResource.Update update(); + + /** + * The template for EnclaveConnectionResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + EnclaveConnectionResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + EnclaveConnectionResource apply(Context context); + } + + /** + * The EnclaveConnectionResource update stages. + */ + interface UpdateStages { + /** + * The stage of the EnclaveConnectionResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the EnclaveConnectionResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Enclave Connection Patch properties. + * + * @param properties Enclave Connection Patch properties. + * @return the next definition stage. + */ + Update withProperties(EnclaveConnectionPatchProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + EnclaveConnectionResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + EnclaveConnectionResource refresh(Context context); + + /** + * Callback that triggers on approval state change. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionState.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionState.java new file mode 100644 index 000000000000..a516391d9415 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the state of the enclave connection. + */ +public final class EnclaveConnectionState extends ExpandableStringEnum { + /** + * EnclaveConnectionState Type Pending Approval. + */ + public static final EnclaveConnectionState PENDING_APPROVAL = fromString("PendingApproval"); + + /** + * EnclaveConnectionState Type Pending Update. + */ + public static final EnclaveConnectionState PENDING_UPDATE = fromString("PendingUpdate"); + + /** + * EnclaveConnectionState Type Approved. + */ + public static final EnclaveConnectionState APPROVED = fromString("Approved"); + + /** + * EnclaveConnectionState Type Active. + */ + public static final EnclaveConnectionState ACTIVE = fromString("Active"); + + /** + * EnclaveConnectionState Type Failed. + */ + public static final EnclaveConnectionState FAILED = fromString("Failed"); + + /** + * EnclaveConnectionState Type Connected. + */ + public static final EnclaveConnectionState CONNECTED = fromString("Connected"); + + /** + * EnclaveConnectionState Type Disconnected. + */ + public static final EnclaveConnectionState DISCONNECTED = fromString("Disconnected"); + + /** + * Creates a new instance of EnclaveConnectionState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EnclaveConnectionState() { + } + + /** + * Creates or finds a EnclaveConnectionState from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnclaveConnectionState. + */ + public static EnclaveConnectionState fromString(String name) { + return fromString(name, EnclaveConnectionState.class); + } + + /** + * Gets known EnclaveConnectionState values. + * + * @return known EnclaveConnectionState values. + */ + public static Collection values() { + return values(EnclaveConnectionState.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnections.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnections.java new file mode 100644 index 000000000000..06260ca71ee5 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnections.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of EnclaveConnections. + */ +public interface EnclaveConnections { + /** + * Get a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveConnectionResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String enclaveConnectionName, Context context); + + /** + * Get a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveConnectionResource. + */ + EnclaveConnectionResource getByResourceGroup(String resourceGroupName, String enclaveConnectionName); + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String enclaveConnectionName); + + /** + * Delete a EnclaveConnectionResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String enclaveConnectionName, Context context); + + /** + * List EnclaveConnectionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List EnclaveConnectionResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List EnclaveConnectionResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List EnclaveConnectionResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveConnectionResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param enclaveConnectionName The name of the Enclave Connection Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body, Context context); + + /** + * Get a EnclaveConnectionResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveConnectionResource along with {@link Response}. + */ + EnclaveConnectionResource getById(String id); + + /** + * Get a EnclaveConnectionResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveConnectionResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a EnclaveConnectionResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a EnclaveConnectionResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new EnclaveConnectionResource resource. + * + * @param name resource name. + * @return the first stage of the new EnclaveConnectionResource definition. + */ + EnclaveConnectionResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveDefaultSettingsModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveDefaultSettingsModel.java new file mode 100644 index 000000000000..221323e84b5e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveDefaultSettingsModel.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Virtual Enclave Default Settings. + */ +@Fluent +public final class EnclaveDefaultSettingsModel implements JsonSerializable { + /* + * Key Vault Resource Id. + */ + private String keyVaultResourceId; + + /* + * Storage Account Resource Id. + */ + private String storageAccountResourceId; + + /* + * Log Analytics Resource Ids. + */ + private List logAnalyticsResourceIdCollection; + + /* + * Diagnostic Destination. + */ + private DiagnosticDestination diagnosticDestination; + + /** + * Creates an instance of EnclaveDefaultSettingsModel class. + */ + public EnclaveDefaultSettingsModel() { + } + + /** + * Get the keyVaultResourceId property: Key Vault Resource Id. + * + * @return the keyVaultResourceId value. + */ + public String keyVaultResourceId() { + return this.keyVaultResourceId; + } + + /** + * Get the storageAccountResourceId property: Storage Account Resource Id. + * + * @return the storageAccountResourceId value. + */ + public String storageAccountResourceId() { + return this.storageAccountResourceId; + } + + /** + * Get the logAnalyticsResourceIdCollection property: Log Analytics Resource Ids. + * + * @return the logAnalyticsResourceIdCollection value. + */ + public List logAnalyticsResourceIdCollection() { + return this.logAnalyticsResourceIdCollection; + } + + /** + * Get the diagnosticDestination property: Diagnostic Destination. + * + * @return the diagnosticDestination value. + */ + public DiagnosticDestination diagnosticDestination() { + return this.diagnosticDestination; + } + + /** + * Set the diagnosticDestination property: Diagnostic Destination. + * + * @param diagnosticDestination the diagnosticDestination value to set. + * @return the EnclaveDefaultSettingsModel object itself. + */ + public EnclaveDefaultSettingsModel withDiagnosticDestination(DiagnosticDestination diagnosticDestination) { + this.diagnosticDestination = diagnosticDestination; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("diagnosticDestination", + this.diagnosticDestination == null ? null : this.diagnosticDestination.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveDefaultSettingsModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveDefaultSettingsModel if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnclaveDefaultSettingsModel. + */ + public static EnclaveDefaultSettingsModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveDefaultSettingsModel deserializedEnclaveDefaultSettingsModel = new EnclaveDefaultSettingsModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyVaultResourceId".equals(fieldName)) { + deserializedEnclaveDefaultSettingsModel.keyVaultResourceId = reader.getString(); + } else if ("storageAccountResourceId".equals(fieldName)) { + deserializedEnclaveDefaultSettingsModel.storageAccountResourceId = reader.getString(); + } else if ("logAnalyticsResourceIdCollection".equals(fieldName)) { + List logAnalyticsResourceIdCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedEnclaveDefaultSettingsModel.logAnalyticsResourceIdCollection + = logAnalyticsResourceIdCollection; + } else if ("diagnosticDestination".equals(fieldName)) { + deserializedEnclaveDefaultSettingsModel.diagnosticDestination + = DiagnosticDestination.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveDefaultSettingsModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveDefaultSettingsPatchModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveDefaultSettingsPatchModel.java new file mode 100644 index 000000000000..8a514a2698ec --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveDefaultSettingsPatchModel.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Virtual Enclave Default Settings. + */ +@Fluent +public final class EnclaveDefaultSettingsPatchModel implements JsonSerializable { + /* + * Diagnostic Destination. + */ + private DiagnosticDestination diagnosticDestination; + + /** + * Creates an instance of EnclaveDefaultSettingsPatchModel class. + */ + public EnclaveDefaultSettingsPatchModel() { + } + + /** + * Get the diagnosticDestination property: Diagnostic Destination. + * + * @return the diagnosticDestination value. + */ + public DiagnosticDestination diagnosticDestination() { + return this.diagnosticDestination; + } + + /** + * Set the diagnosticDestination property: Diagnostic Destination. + * + * @param diagnosticDestination the diagnosticDestination value to set. + * @return the EnclaveDefaultSettingsPatchModel object itself. + */ + public EnclaveDefaultSettingsPatchModel withDiagnosticDestination(DiagnosticDestination diagnosticDestination) { + this.diagnosticDestination = diagnosticDestination; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("diagnosticDestination", + this.diagnosticDestination == null ? null : this.diagnosticDestination.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveDefaultSettingsPatchModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveDefaultSettingsPatchModel if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnclaveDefaultSettingsPatchModel. + */ + public static EnclaveDefaultSettingsPatchModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveDefaultSettingsPatchModel deserializedEnclaveDefaultSettingsPatchModel + = new EnclaveDefaultSettingsPatchModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("diagnosticDestination".equals(fieldName)) { + deserializedEnclaveDefaultSettingsPatchModel.diagnosticDestination + = DiagnosticDestination.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveDefaultSettingsPatchModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointDestinationRule.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointDestinationRule.java new file mode 100644 index 000000000000..c007b22debf5 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointDestinationRule.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Enclave Endpoint Rule Properties. + */ +@Fluent +public final class EnclaveEndpointDestinationRule implements JsonSerializable { + /* + * Protocols. Options specified by Endpoint Protocol Enum. + */ + private List protocols; + + /* + * Endpoint Rule Name. + */ + private String endpointRuleName; + + /* + * Destination address. Can include multiple CIDR/IP Addresses or fqdn tags or fqdns (for community endpoint) + * separated by commas. + */ + private String destination; + + /* + * Port. Can include multiple ports separated by commas or a range indicated by a hyphen. + */ + private String ports; + + /** + * Creates an instance of EnclaveEndpointDestinationRule class. + */ + public EnclaveEndpointDestinationRule() { + } + + /** + * Get the protocols property: Protocols. Options specified by Endpoint Protocol Enum. + * + * @return the protocols value. + */ + public List protocols() { + return this.protocols; + } + + /** + * Set the protocols property: Protocols. Options specified by Endpoint Protocol Enum. + * + * @param protocols the protocols value to set. + * @return the EnclaveEndpointDestinationRule object itself. + */ + public EnclaveEndpointDestinationRule withProtocols(List protocols) { + this.protocols = protocols; + return this; + } + + /** + * Get the endpointRuleName property: Endpoint Rule Name. + * + * @return the endpointRuleName value. + */ + public String endpointRuleName() { + return this.endpointRuleName; + } + + /** + * Set the endpointRuleName property: Endpoint Rule Name. + * + * @param endpointRuleName the endpointRuleName value to set. + * @return the EnclaveEndpointDestinationRule object itself. + */ + public EnclaveEndpointDestinationRule withEndpointRuleName(String endpointRuleName) { + this.endpointRuleName = endpointRuleName; + return this; + } + + /** + * Get the destination property: Destination address. Can include multiple CIDR/IP Addresses or fqdn tags or fqdns + * (for community endpoint) separated by commas. + * + * @return the destination value. + */ + public String destination() { + return this.destination; + } + + /** + * Set the destination property: Destination address. Can include multiple CIDR/IP Addresses or fqdn tags or fqdns + * (for community endpoint) separated by commas. + * + * @param destination the destination value to set. + * @return the EnclaveEndpointDestinationRule object itself. + */ + public EnclaveEndpointDestinationRule withDestination(String destination) { + this.destination = destination; + return this; + } + + /** + * Get the ports property: Port. Can include multiple ports separated by commas or a range indicated by a hyphen. + * + * @return the ports value. + */ + public String ports() { + return this.ports; + } + + /** + * Set the ports property: Port. Can include multiple ports separated by commas or a range indicated by a hyphen. + * + * @param ports the ports value to set. + * @return the EnclaveEndpointDestinationRule object itself. + */ + public EnclaveEndpointDestinationRule withPorts(String ports) { + this.ports = ports; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("protocols", this.protocols, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("endpointRuleName", this.endpointRuleName); + jsonWriter.writeStringField("destination", this.destination); + jsonWriter.writeStringField("ports", this.ports); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveEndpointDestinationRule from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveEndpointDestinationRule if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnclaveEndpointDestinationRule. + */ + public static EnclaveEndpointDestinationRule fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveEndpointDestinationRule deserializedEnclaveEndpointDestinationRule + = new EnclaveEndpointDestinationRule(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protocols".equals(fieldName)) { + List protocols + = reader.readArray(reader1 -> EnclaveEndpointProtocol.fromString(reader1.getString())); + deserializedEnclaveEndpointDestinationRule.protocols = protocols; + } else if ("endpointRuleName".equals(fieldName)) { + deserializedEnclaveEndpointDestinationRule.endpointRuleName = reader.getString(); + } else if ("destination".equals(fieldName)) { + deserializedEnclaveEndpointDestinationRule.destination = reader.getString(); + } else if ("ports".equals(fieldName)) { + deserializedEnclaveEndpointDestinationRule.ports = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveEndpointDestinationRule; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointPatchModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointPatchModel.java new file mode 100644 index 000000000000..5caf41f022f1 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointPatchModel.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Enclave Endpoint Patch Resource. + */ +@Fluent +public final class EnclaveEndpointPatchModel implements JsonSerializable { + /* + * Enclave Endpoint Patch properties + */ + private EnclaveEndpointPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of EnclaveEndpointPatchModel class. + */ + public EnclaveEndpointPatchModel() { + } + + /** + * Get the properties property: Enclave Endpoint Patch properties. + * + * @return the properties value. + */ + public EnclaveEndpointPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Enclave Endpoint Patch properties. + * + * @param properties the properties value to set. + * @return the EnclaveEndpointPatchModel object itself. + */ + public EnclaveEndpointPatchModel withProperties(EnclaveEndpointPatchProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the EnclaveEndpointPatchModel object itself. + */ + public EnclaveEndpointPatchModel withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveEndpointPatchModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveEndpointPatchModel if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnclaveEndpointPatchModel. + */ + public static EnclaveEndpointPatchModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveEndpointPatchModel deserializedEnclaveEndpointPatchModel = new EnclaveEndpointPatchModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedEnclaveEndpointPatchModel.properties = EnclaveEndpointPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEnclaveEndpointPatchModel.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveEndpointPatchModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointPatchProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointPatchProperties.java new file mode 100644 index 000000000000..065576bd71c9 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointPatchProperties.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Enclave Endpoint patchable Properties. + */ +@Fluent +public final class EnclaveEndpointPatchProperties implements JsonSerializable { + /* + * Enclave Endpoint Rule Collection. + */ + private List ruleCollection; + + /** + * Creates an instance of EnclaveEndpointPatchProperties class. + */ + public EnclaveEndpointPatchProperties() { + } + + /** + * Get the ruleCollection property: Enclave Endpoint Rule Collection. + * + * @return the ruleCollection value. + */ + public List ruleCollection() { + return this.ruleCollection; + } + + /** + * Set the ruleCollection property: Enclave Endpoint Rule Collection. + * + * @param ruleCollection the ruleCollection value to set. + * @return the EnclaveEndpointPatchProperties object itself. + */ + public EnclaveEndpointPatchProperties withRuleCollection(List ruleCollection) { + this.ruleCollection = ruleCollection; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ruleCollection", this.ruleCollection, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveEndpointPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveEndpointPatchProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnclaveEndpointPatchProperties. + */ + public static EnclaveEndpointPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveEndpointPatchProperties deserializedEnclaveEndpointPatchProperties + = new EnclaveEndpointPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ruleCollection".equals(fieldName)) { + List ruleCollection + = reader.readArray(reader1 -> EnclaveEndpointDestinationRule.fromJson(reader1)); + deserializedEnclaveEndpointPatchProperties.ruleCollection = ruleCollection; + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveEndpointPatchProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointProperties.java new file mode 100644 index 000000000000..1a4ec998f80f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointProperties.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Enclave Endpoint Resource properties. + */ +@Fluent +public final class EnclaveEndpointProperties implements JsonSerializable { + /* + * Enclave Endpoint Rule Collection. + */ + private List ruleCollection; + + /* + * List of resource ids created by community endpoint. + */ + private List resourceCollection; + + /* + * Provisioning State. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of EnclaveEndpointProperties class. + */ + public EnclaveEndpointProperties() { + } + + /** + * Get the ruleCollection property: Enclave Endpoint Rule Collection. + * + * @return the ruleCollection value. + */ + public List ruleCollection() { + return this.ruleCollection; + } + + /** + * Set the ruleCollection property: Enclave Endpoint Rule Collection. + * + * @param ruleCollection the ruleCollection value to set. + * @return the EnclaveEndpointProperties object itself. + */ + public EnclaveEndpointProperties withRuleCollection(List ruleCollection) { + this.ruleCollection = ruleCollection; + return this; + } + + /** + * Get the resourceCollection property: List of resource ids created by community endpoint. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.resourceCollection; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ruleCollection", this.ruleCollection, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveEndpointProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveEndpointProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EnclaveEndpointProperties. + */ + public static EnclaveEndpointProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveEndpointProperties deserializedEnclaveEndpointProperties = new EnclaveEndpointProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ruleCollection".equals(fieldName)) { + List ruleCollection + = reader.readArray(reader1 -> EnclaveEndpointDestinationRule.fromJson(reader1)); + deserializedEnclaveEndpointProperties.ruleCollection = ruleCollection; + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedEnclaveEndpointProperties.resourceCollection = resourceCollection; + } else if ("provisioningState".equals(fieldName)) { + deserializedEnclaveEndpointProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveEndpointProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointProtocol.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointProtocol.java new file mode 100644 index 000000000000..b70badfa59de --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointProtocol.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enclave Endpoint Protocol Enum. + */ +public final class EnclaveEndpointProtocol extends ExpandableStringEnum { + /** + * EndpointProtocol Type ANY. + */ + public static final EnclaveEndpointProtocol ANY = fromString("ANY"); + + /** + * EndpointProtocol Type TCP. + */ + public static final EnclaveEndpointProtocol TCP = fromString("TCP"); + + /** + * EndpointProtocol Type UDP. + */ + public static final EnclaveEndpointProtocol UDP = fromString("UDP"); + + /** + * EndpointProtocol Type ICMP. + */ + public static final EnclaveEndpointProtocol ICMP = fromString("ICMP"); + + /** + * EndpointProtocol Type ESP. + */ + public static final EnclaveEndpointProtocol ESP = fromString("ESP"); + + /** + * EndpointProtocol Type AH. + */ + public static final EnclaveEndpointProtocol AH = fromString("AH"); + + /** + * Creates a new instance of EnclaveEndpointProtocol value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public EnclaveEndpointProtocol() { + } + + /** + * Creates or finds a EnclaveEndpointProtocol from its string representation. + * + * @param name a name to look for. + * @return the corresponding EnclaveEndpointProtocol. + */ + public static EnclaveEndpointProtocol fromString(String name) { + return fromString(name, EnclaveEndpointProtocol.class); + } + + /** + * Gets known EnclaveEndpointProtocol values. + * + * @return known EnclaveEndpointProtocol values. + */ + public static Collection values() { + return values(EnclaveEndpointProtocol.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointResource.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointResource.java new file mode 100644 index 000000000000..cf32b4ccba14 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointResource.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveEndpointResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of EnclaveEndpointResource. + */ +public interface EnclaveEndpointResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + EnclaveEndpointProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveEndpointResourceInner object. + * + * @return the inner object. + */ + EnclaveEndpointResourceInner innerModel(); + + /** + * The entirety of the EnclaveEndpointResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The EnclaveEndpointResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the EnclaveEndpointResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the EnclaveEndpointResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the EnclaveEndpointResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, virtualEnclaveName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @return the next definition stage. + */ + WithCreate withExistingVirtualEnclave(String resourceGroupName, String virtualEnclaveName); + } + + /** + * The stage of the EnclaveEndpointResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + EnclaveEndpointResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + EnclaveEndpointResource create(Context context); + } + + /** + * The stage of the EnclaveEndpointResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the EnclaveEndpointResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(EnclaveEndpointProperties properties); + } + } + + /** + * Begins update for the EnclaveEndpointResource resource. + * + * @return the stage of resource update. + */ + EnclaveEndpointResource.Update update(); + + /** + * The template for EnclaveEndpointResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + EnclaveEndpointResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + EnclaveEndpointResource apply(Context context); + } + + /** + * The EnclaveEndpointResource update stages. + */ + interface UpdateStages { + /** + * The stage of the EnclaveEndpointResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the EnclaveEndpointResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Enclave Endpoint Patch properties. + * + * @param properties Enclave Endpoint Patch properties. + * @return the next definition stage. + */ + Update withProperties(EnclaveEndpointPatchProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + EnclaveEndpointResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + EnclaveEndpointResource refresh(Context context); + + /** + * Callback that triggers on approval state change. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpoints.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpoints.java new file mode 100644 index 000000000000..8acdba10004a --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpoints.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of EnclaveEndpoints. + */ +public interface EnclaveEndpoints { + /** + * Get a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveEndpointResource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, Context context); + + /** + * Get a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveEndpointResource. + */ + EnclaveEndpointResource get(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName); + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName); + + /** + * Delete a EnclaveEndpointResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, Context context); + + /** + * List EnclaveEndpointResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByEnclaveResource(String resourceGroupName, String virtualEnclaveName); + + /** + * List EnclaveEndpointResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByEnclaveResource(String resourceGroupName, String virtualEnclaveName, + Context context); + + /** + * List EnclaveEndpointResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listBySubscription(String virtualEnclaveName); + + /** + * List EnclaveEndpointResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveEndpointResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listBySubscription(String virtualEnclaveName, Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param enclaveEndpointName The name of the Enclave Endpoint Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body, Context context); + + /** + * Get a EnclaveEndpointResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveEndpointResource along with {@link Response}. + */ + EnclaveEndpointResource getById(String id); + + /** + * Get a EnclaveEndpointResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveEndpointResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a EnclaveEndpointResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a EnclaveEndpointResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new EnclaveEndpointResource resource. + * + * @param name resource name. + * @return the first stage of the new EnclaveEndpointResource definition. + */ + EnclaveEndpointResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveResource.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveResource.java new file mode 100644 index 000000000000..5f2528b8df75 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveResource.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of EnclaveResource. + */ +public interface EnclaveResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + VirtualEnclaveProperties properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveResourceInner object. + * + * @return the inner object. + */ + EnclaveResourceInner innerModel(); + + /** + * The entirety of the EnclaveResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The EnclaveResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the EnclaveResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the EnclaveResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the EnclaveResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the EnclaveResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + EnclaveResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + EnclaveResource create(Context context); + } + + /** + * The stage of the EnclaveResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the EnclaveResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(VirtualEnclaveProperties properties); + } + + /** + * The stage of the EnclaveResource definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Begins update for the EnclaveResource resource. + * + * @return the stage of resource update. + */ + EnclaveResource.Update update(); + + /** + * The template for EnclaveResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + EnclaveResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + EnclaveResource apply(Context context); + } + + /** + * The EnclaveResource update stages. + */ + interface UpdateStages { + /** + * The stage of the EnclaveResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the EnclaveResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Virtual Enclave Patch properties. + * + * @param properties Virtual Enclave Patch properties. + * @return the next definition stage. + */ + Update withProperties(VirtualEnclavePatchProperties properties); + } + + /** + * The stage of the EnclaveResource update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + EnclaveResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + EnclaveResource refresh(Context context); + + /** + * Callback that triggers on approval state change. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveVirtualNetworkModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveVirtualNetworkModel.java new file mode 100644 index 000000000000..b2b52066a8a4 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveVirtualNetworkModel.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Enclave Virtual Network Properties. + */ +@Fluent +public final class EnclaveVirtualNetworkModel implements JsonSerializable { + /* + * Network Name. + */ + private String networkName; + + /* + * Network Size. + */ + private String networkSize; + + /* + * Custom CIDR Range. + */ + private String customCidrRange; + + /* + * Subnet Configurations. + */ + private List subnetConfigurations; + + /* + * Allow Subnet Communication. + */ + private Boolean allowSubnetCommunication; + + /** + * Creates an instance of EnclaveVirtualNetworkModel class. + */ + public EnclaveVirtualNetworkModel() { + } + + /** + * Get the networkName property: Network Name. + * + * @return the networkName value. + */ + public String networkName() { + return this.networkName; + } + + /** + * Set the networkName property: Network Name. + * + * @param networkName the networkName value to set. + * @return the EnclaveVirtualNetworkModel object itself. + */ + public EnclaveVirtualNetworkModel withNetworkName(String networkName) { + this.networkName = networkName; + return this; + } + + /** + * Get the networkSize property: Network Size. + * + * @return the networkSize value. + */ + public String networkSize() { + return this.networkSize; + } + + /** + * Set the networkSize property: Network Size. + * + * @param networkSize the networkSize value to set. + * @return the EnclaveVirtualNetworkModel object itself. + */ + public EnclaveVirtualNetworkModel withNetworkSize(String networkSize) { + this.networkSize = networkSize; + return this; + } + + /** + * Get the customCidrRange property: Custom CIDR Range. + * + * @return the customCidrRange value. + */ + public String customCidrRange() { + return this.customCidrRange; + } + + /** + * Set the customCidrRange property: Custom CIDR Range. + * + * @param customCidrRange the customCidrRange value to set. + * @return the EnclaveVirtualNetworkModel object itself. + */ + public EnclaveVirtualNetworkModel withCustomCidrRange(String customCidrRange) { + this.customCidrRange = customCidrRange; + return this; + } + + /** + * Get the subnetConfigurations property: Subnet Configurations. + * + * @return the subnetConfigurations value. + */ + public List subnetConfigurations() { + return this.subnetConfigurations; + } + + /** + * Set the subnetConfigurations property: Subnet Configurations. + * + * @param subnetConfigurations the subnetConfigurations value to set. + * @return the EnclaveVirtualNetworkModel object itself. + */ + public EnclaveVirtualNetworkModel withSubnetConfigurations(List subnetConfigurations) { + this.subnetConfigurations = subnetConfigurations; + return this; + } + + /** + * Get the allowSubnetCommunication property: Allow Subnet Communication. + * + * @return the allowSubnetCommunication value. + */ + public Boolean allowSubnetCommunication() { + return this.allowSubnetCommunication; + } + + /** + * Set the allowSubnetCommunication property: Allow Subnet Communication. + * + * @param allowSubnetCommunication the allowSubnetCommunication value to set. + * @return the EnclaveVirtualNetworkModel object itself. + */ + public EnclaveVirtualNetworkModel withAllowSubnetCommunication(Boolean allowSubnetCommunication) { + this.allowSubnetCommunication = allowSubnetCommunication; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("networkName", this.networkName); + jsonWriter.writeStringField("networkSize", this.networkSize); + jsonWriter.writeStringField("customCidrRange", this.customCidrRange); + jsonWriter.writeArrayField("subnetConfigurations", this.subnetConfigurations, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeBooleanField("allowSubnetCommunication", this.allowSubnetCommunication); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveVirtualNetworkModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveVirtualNetworkModel if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EnclaveVirtualNetworkModel. + */ + public static EnclaveVirtualNetworkModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveVirtualNetworkModel deserializedEnclaveVirtualNetworkModel = new EnclaveVirtualNetworkModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("networkName".equals(fieldName)) { + deserializedEnclaveVirtualNetworkModel.networkName = reader.getString(); + } else if ("networkSize".equals(fieldName)) { + deserializedEnclaveVirtualNetworkModel.networkSize = reader.getString(); + } else if ("customCidrRange".equals(fieldName)) { + deserializedEnclaveVirtualNetworkModel.customCidrRange = reader.getString(); + } else if ("subnetConfigurations".equals(fieldName)) { + List subnetConfigurations + = reader.readArray(reader1 -> SubnetConfiguration.fromJson(reader1)); + deserializedEnclaveVirtualNetworkModel.subnetConfigurations = subnetConfigurations; + } else if ("allowSubnetCommunication".equals(fieldName)) { + deserializedEnclaveVirtualNetworkModel.allowSubnetCommunication + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveVirtualNetworkModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/FirewallSKU.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/FirewallSKU.java new file mode 100644 index 000000000000..4f8371c2f4c6 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/FirewallSKU.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Azure Firewall SKU. + */ +public final class FirewallSKU extends ExpandableStringEnum { + /** + * FirewallSKU Basic. + */ + public static final FirewallSKU BASIC = fromString("Basic"); + + /** + * FirwallSKU Standard. + */ + public static final FirewallSKU STANDARD = fromString("Standard"); + + /** + * FirewallSKU Premium. + */ + public static final FirewallSKU PREMIUM = fromString("Premium"); + + /** + * Creates a new instance of FirewallSKU value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public FirewallSKU() { + } + + /** + * Creates or finds a FirewallSKU from its string representation. + * + * @param name a name to look for. + * @return the corresponding FirewallSKU. + */ + public static FirewallSKU fromString(String name) { + return fromString(name, FirewallSKU.class); + } + + /** + * Gets known FirewallSKU values. + * + * @return known FirewallSKU values. + */ + public static Collection values() { + return values(FirewallSKU.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItem.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItem.java new file mode 100644 index 000000000000..3731653c3325 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItem.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * GovernedServiceItem Properties. + */ +@Fluent +public final class GovernedServiceItem implements JsonSerializable { + /* + * Service ID + */ + private ServiceIdentifier serviceId; + + /* + * Service name. + */ + private String serviceName; + + /* + * Governance option for this service (Allow, Deny, ExceptionOnly, or NotApplicable). + */ + private GovernedServiceItemOption option; + + /* + * Initiative enforcement (Enabled or Disabled). + */ + private GovernedServiceItemEnforcement enforcement; + + /* + * Enforcement mode for policy. AuditOnly, Enforce, or None. + */ + private GovernedServiceItemPolicyAction policyAction; + + /* + * Initiatives associated with this service. + */ + private List initiatives; + + /** + * Creates an instance of GovernedServiceItem class. + */ + public GovernedServiceItem() { + } + + /** + * Get the serviceId property: Service ID. + * + * @return the serviceId value. + */ + public ServiceIdentifier serviceId() { + return this.serviceId; + } + + /** + * Set the serviceId property: Service ID. + * + * @param serviceId the serviceId value to set. + * @return the GovernedServiceItem object itself. + */ + public GovernedServiceItem withServiceId(ServiceIdentifier serviceId) { + this.serviceId = serviceId; + return this; + } + + /** + * Get the serviceName property: Service name. + * + * @return the serviceName value. + */ + public String serviceName() { + return this.serviceName; + } + + /** + * Get the option property: Governance option for this service (Allow, Deny, ExceptionOnly, or NotApplicable). + * + * @return the option value. + */ + public GovernedServiceItemOption option() { + return this.option; + } + + /** + * Set the option property: Governance option for this service (Allow, Deny, ExceptionOnly, or NotApplicable). + * + * @param option the option value to set. + * @return the GovernedServiceItem object itself. + */ + public GovernedServiceItem withOption(GovernedServiceItemOption option) { + this.option = option; + return this; + } + + /** + * Get the enforcement property: Initiative enforcement (Enabled or Disabled). + * + * @return the enforcement value. + */ + public GovernedServiceItemEnforcement enforcement() { + return this.enforcement; + } + + /** + * Set the enforcement property: Initiative enforcement (Enabled or Disabled). + * + * @param enforcement the enforcement value to set. + * @return the GovernedServiceItem object itself. + */ + public GovernedServiceItem withEnforcement(GovernedServiceItemEnforcement enforcement) { + this.enforcement = enforcement; + return this; + } + + /** + * Get the policyAction property: Enforcement mode for policy. AuditOnly, Enforce, or None. + * + * @return the policyAction value. + */ + public GovernedServiceItemPolicyAction policyAction() { + return this.policyAction; + } + + /** + * Set the policyAction property: Enforcement mode for policy. AuditOnly, Enforce, or None. + * + * @param policyAction the policyAction value to set. + * @return the GovernedServiceItem object itself. + */ + public GovernedServiceItem withPolicyAction(GovernedServiceItemPolicyAction policyAction) { + this.policyAction = policyAction; + return this; + } + + /** + * Get the initiatives property: Initiatives associated with this service. + * + * @return the initiatives value. + */ + public List initiatives() { + return this.initiatives; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serviceId", this.serviceId == null ? null : this.serviceId.toString()); + jsonWriter.writeStringField("option", this.option == null ? null : this.option.toString()); + jsonWriter.writeStringField("enforcement", this.enforcement == null ? null : this.enforcement.toString()); + jsonWriter.writeStringField("policyAction", this.policyAction == null ? null : this.policyAction.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GovernedServiceItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GovernedServiceItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the GovernedServiceItem. + */ + public static GovernedServiceItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GovernedServiceItem deserializedGovernedServiceItem = new GovernedServiceItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serviceId".equals(fieldName)) { + deserializedGovernedServiceItem.serviceId = ServiceIdentifier.fromString(reader.getString()); + } else if ("serviceName".equals(fieldName)) { + deserializedGovernedServiceItem.serviceName = reader.getString(); + } else if ("option".equals(fieldName)) { + deserializedGovernedServiceItem.option = GovernedServiceItemOption.fromString(reader.getString()); + } else if ("enforcement".equals(fieldName)) { + deserializedGovernedServiceItem.enforcement + = GovernedServiceItemEnforcement.fromString(reader.getString()); + } else if ("policyAction".equals(fieldName)) { + deserializedGovernedServiceItem.policyAction + = GovernedServiceItemPolicyAction.fromString(reader.getString()); + } else if ("initiatives".equals(fieldName)) { + List initiatives = reader.readArray(reader1 -> reader1.getString()); + deserializedGovernedServiceItem.initiatives = initiatives; + } else { + reader.skipChildren(); + } + } + + return deserializedGovernedServiceItem; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemEnforcement.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemEnforcement.java new file mode 100644 index 000000000000..c487d1c14592 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemEnforcement.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for GovernedServiceItemEnforcement. + */ +public final class GovernedServiceItemEnforcement extends ExpandableStringEnum { + /** + * Static value Enabled for GovernedServiceItemEnforcement. + */ + public static final GovernedServiceItemEnforcement ENABLED = fromString("Enabled"); + + /** + * Static value Disabled for GovernedServiceItemEnforcement. + */ + public static final GovernedServiceItemEnforcement DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of GovernedServiceItemEnforcement value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public GovernedServiceItemEnforcement() { + } + + /** + * Creates or finds a GovernedServiceItemEnforcement from its string representation. + * + * @param name a name to look for. + * @return the corresponding GovernedServiceItemEnforcement. + */ + public static GovernedServiceItemEnforcement fromString(String name) { + return fromString(name, GovernedServiceItemEnforcement.class); + } + + /** + * Gets known GovernedServiceItemEnforcement values. + * + * @return known GovernedServiceItemEnforcement values. + */ + public static Collection values() { + return values(GovernedServiceItemEnforcement.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemOption.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemOption.java new file mode 100644 index 000000000000..a41255a15ebe --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemOption.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for GovernedServiceItemOption. + */ +public final class GovernedServiceItemOption extends ExpandableStringEnum { + /** + * Static value Allow for GovernedServiceItemOption. + */ + public static final GovernedServiceItemOption ALLOW = fromString("Allow"); + + /** + * Static value Deny for GovernedServiceItemOption. + */ + public static final GovernedServiceItemOption DENY = fromString("Deny"); + + /** + * Static value ExceptionOnly for GovernedServiceItemOption. + */ + public static final GovernedServiceItemOption EXCEPTION_ONLY = fromString("ExceptionOnly"); + + /** + * Static value NotApplicable for GovernedServiceItemOption. + */ + public static final GovernedServiceItemOption NOT_APPLICABLE = fromString("NotApplicable"); + + /** + * Creates a new instance of GovernedServiceItemOption value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public GovernedServiceItemOption() { + } + + /** + * Creates or finds a GovernedServiceItemOption from its string representation. + * + * @param name a name to look for. + * @return the corresponding GovernedServiceItemOption. + */ + public static GovernedServiceItemOption fromString(String name) { + return fromString(name, GovernedServiceItemOption.class); + } + + /** + * Gets known GovernedServiceItemOption values. + * + * @return known GovernedServiceItemOption values. + */ + public static Collection values() { + return values(GovernedServiceItemOption.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemPolicyAction.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemPolicyAction.java new file mode 100644 index 000000000000..f4cd0f84853b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemPolicyAction.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for GovernedServiceItemPolicyAction. + */ +public final class GovernedServiceItemPolicyAction extends ExpandableStringEnum { + /** + * Static value AuditOnly for GovernedServiceItemPolicyAction. + */ + public static final GovernedServiceItemPolicyAction AUDIT_ONLY = fromString("AuditOnly"); + + /** + * Static value Enforce for GovernedServiceItemPolicyAction. + */ + public static final GovernedServiceItemPolicyAction ENFORCE = fromString("Enforce"); + + /** + * Static value None for GovernedServiceItemPolicyAction. + */ + public static final GovernedServiceItemPolicyAction NONE = fromString("None"); + + /** + * Creates a new instance of GovernedServiceItemPolicyAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public GovernedServiceItemPolicyAction() { + } + + /** + * Creates or finds a GovernedServiceItemPolicyAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding GovernedServiceItemPolicyAction. + */ + public static GovernedServiceItemPolicyAction fromString(String name) { + return fromString(name, GovernedServiceItemPolicyAction.class); + } + + /** + * Gets known GovernedServiceItemPolicyAction values. + * + * @return known GovernedServiceItemPolicyAction values. + */ + public static Collection values() { + return values(GovernedServiceItemPolicyAction.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModel.java new file mode 100644 index 000000000000..e9e8ebe8962f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModel.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Maintenance Mode. + */ +@Fluent +public final class MaintenanceModeConfigurationModel implements JsonSerializable { + /* + * Current mode of Maintenance Mode Configuration + */ + private MaintenanceModeConfigurationModelMode mode; + + /* + * The user, group or service principal object affected by Maintenance Mode + */ + private List principals; + + /* + * Justification for entering or exiting Maintenance Mode + */ + private MaintenanceModeConfigurationModelJustification justification; + + /** + * Creates an instance of MaintenanceModeConfigurationModel class. + */ + public MaintenanceModeConfigurationModel() { + } + + /** + * Get the mode property: Current mode of Maintenance Mode Configuration. + * + * @return the mode value. + */ + public MaintenanceModeConfigurationModelMode mode() { + return this.mode; + } + + /** + * Set the mode property: Current mode of Maintenance Mode Configuration. + * + * @param mode the mode value to set. + * @return the MaintenanceModeConfigurationModel object itself. + */ + public MaintenanceModeConfigurationModel withMode(MaintenanceModeConfigurationModelMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the principals property: The user, group or service principal object affected by Maintenance Mode. + * + * @return the principals value. + */ + public List principals() { + return this.principals; + } + + /** + * Set the principals property: The user, group or service principal object affected by Maintenance Mode. + * + * @param principals the principals value to set. + * @return the MaintenanceModeConfigurationModel object itself. + */ + public MaintenanceModeConfigurationModel withPrincipals(List principals) { + this.principals = principals; + return this; + } + + /** + * Get the justification property: Justification for entering or exiting Maintenance Mode. + * + * @return the justification value. + */ + public MaintenanceModeConfigurationModelJustification justification() { + return this.justification; + } + + /** + * Set the justification property: Justification for entering or exiting Maintenance Mode. + * + * @param justification the justification value to set. + * @return the MaintenanceModeConfigurationModel object itself. + */ + public MaintenanceModeConfigurationModel + withJustification(MaintenanceModeConfigurationModelJustification justification) { + this.justification = justification; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("mode", this.mode == null ? null : this.mode.toString()); + jsonWriter.writeArrayField("principals", this.principals, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("justification", this.justification == null ? null : this.justification.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MaintenanceModeConfigurationModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MaintenanceModeConfigurationModel if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MaintenanceModeConfigurationModel. + */ + public static MaintenanceModeConfigurationModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MaintenanceModeConfigurationModel deserializedMaintenanceModeConfigurationModel + = new MaintenanceModeConfigurationModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mode".equals(fieldName)) { + deserializedMaintenanceModeConfigurationModel.mode + = MaintenanceModeConfigurationModelMode.fromString(reader.getString()); + } else if ("principals".equals(fieldName)) { + List principals = reader.readArray(reader1 -> Principal.fromJson(reader1)); + deserializedMaintenanceModeConfigurationModel.principals = principals; + } else if ("justification".equals(fieldName)) { + deserializedMaintenanceModeConfigurationModel.justification + = MaintenanceModeConfigurationModelJustification.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMaintenanceModeConfigurationModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModelJustification.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModelJustification.java new file mode 100644 index 000000000000..f82e23fc0861 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModelJustification.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for MaintenanceModeConfigurationModelJustification. + */ +public final class MaintenanceModeConfigurationModelJustification + extends ExpandableStringEnum { + /** + * Static value Networking for MaintenanceModeConfigurationModelJustification. + */ + public static final MaintenanceModeConfigurationModelJustification NETWORKING = fromString("Networking"); + + /** + * Static value Governance for MaintenanceModeConfigurationModelJustification. + */ + public static final MaintenanceModeConfigurationModelJustification GOVERNANCE = fromString("Governance"); + + /** + * Static value Off for MaintenanceModeConfigurationModelJustification. + */ + public static final MaintenanceModeConfigurationModelJustification OFF = fromString("Off"); + + /** + * Creates a new instance of MaintenanceModeConfigurationModelJustification value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MaintenanceModeConfigurationModelJustification() { + } + + /** + * Creates or finds a MaintenanceModeConfigurationModelJustification from its string representation. + * + * @param name a name to look for. + * @return the corresponding MaintenanceModeConfigurationModelJustification. + */ + public static MaintenanceModeConfigurationModelJustification fromString(String name) { + return fromString(name, MaintenanceModeConfigurationModelJustification.class); + } + + /** + * Gets known MaintenanceModeConfigurationModelJustification values. + * + * @return known MaintenanceModeConfigurationModelJustification values. + */ + public static Collection values() { + return values(MaintenanceModeConfigurationModelJustification.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModelMode.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModelMode.java new file mode 100644 index 000000000000..4f26af23daeb --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModelMode.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for MaintenanceModeConfigurationModelMode. + */ +public final class MaintenanceModeConfigurationModelMode + extends ExpandableStringEnum { + /** + * Static value On for MaintenanceModeConfigurationModelMode. + */ + public static final MaintenanceModeConfigurationModelMode ON = fromString("On"); + + /** + * Static value CanNotDelete for MaintenanceModeConfigurationModelMode. + */ + public static final MaintenanceModeConfigurationModelMode CAN_NOT_DELETE = fromString("CanNotDelete"); + + /** + * Static value Off for MaintenanceModeConfigurationModelMode. + */ + public static final MaintenanceModeConfigurationModelMode OFF = fromString("Off"); + + /** + * Static value General for MaintenanceModeConfigurationModelMode. + */ + public static final MaintenanceModeConfigurationModelMode GENERAL = fromString("General"); + + /** + * Static value Advanced for MaintenanceModeConfigurationModelMode. + */ + public static final MaintenanceModeConfigurationModelMode ADVANCED = fromString("Advanced"); + + /** + * Creates a new instance of MaintenanceModeConfigurationModelMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MaintenanceModeConfigurationModelMode() { + } + + /** + * Creates or finds a MaintenanceModeConfigurationModelMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding MaintenanceModeConfigurationModelMode. + */ + public static MaintenanceModeConfigurationModelMode fromString(String name) { + return fromString(name, MaintenanceModeConfigurationModelMode.class); + } + + /** + * Gets known MaintenanceModeConfigurationModelMode values. + * + * @return known MaintenanceModeConfigurationModelMode values. + */ + public static Collection values() { + return values(MaintenanceModeConfigurationModelMode.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationPatchModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationPatchModel.java new file mode 100644 index 000000000000..e729d50ffb44 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationPatchModel.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Maintenance Mode Patch Model. + */ +@Fluent +public final class MaintenanceModeConfigurationPatchModel + implements JsonSerializable { + /* + * Current mode of Maintenance Mode Configuration + */ + private MaintenanceModeConfigurationModelMode mode; + + /* + * The user, group or service principal object affected by Maintenance Mode + */ + private List principals; + + /* + * Justification for entering or exiting Maintenance Mode + */ + private MaintenanceModeConfigurationModelJustification justification; + + /** + * Creates an instance of MaintenanceModeConfigurationPatchModel class. + */ + public MaintenanceModeConfigurationPatchModel() { + } + + /** + * Get the mode property: Current mode of Maintenance Mode Configuration. + * + * @return the mode value. + */ + public MaintenanceModeConfigurationModelMode mode() { + return this.mode; + } + + /** + * Set the mode property: Current mode of Maintenance Mode Configuration. + * + * @param mode the mode value to set. + * @return the MaintenanceModeConfigurationPatchModel object itself. + */ + public MaintenanceModeConfigurationPatchModel withMode(MaintenanceModeConfigurationModelMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the principals property: The user, group or service principal object affected by Maintenance Mode. + * + * @return the principals value. + */ + public List principals() { + return this.principals; + } + + /** + * Set the principals property: The user, group or service principal object affected by Maintenance Mode. + * + * @param principals the principals value to set. + * @return the MaintenanceModeConfigurationPatchModel object itself. + */ + public MaintenanceModeConfigurationPatchModel withPrincipals(List principals) { + this.principals = principals; + return this; + } + + /** + * Get the justification property: Justification for entering or exiting Maintenance Mode. + * + * @return the justification value. + */ + public MaintenanceModeConfigurationModelJustification justification() { + return this.justification; + } + + /** + * Set the justification property: Justification for entering or exiting Maintenance Mode. + * + * @param justification the justification value to set. + * @return the MaintenanceModeConfigurationPatchModel object itself. + */ + public MaintenanceModeConfigurationPatchModel + withJustification(MaintenanceModeConfigurationModelJustification justification) { + this.justification = justification; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("mode", this.mode == null ? null : this.mode.toString()); + jsonWriter.writeArrayField("principals", this.principals, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("justification", this.justification == null ? null : this.justification.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MaintenanceModeConfigurationPatchModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MaintenanceModeConfigurationPatchModel if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MaintenanceModeConfigurationPatchModel. + */ + public static MaintenanceModeConfigurationPatchModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MaintenanceModeConfigurationPatchModel deserializedMaintenanceModeConfigurationPatchModel + = new MaintenanceModeConfigurationPatchModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mode".equals(fieldName)) { + deserializedMaintenanceModeConfigurationPatchModel.mode + = MaintenanceModeConfigurationModelMode.fromString(reader.getString()); + } else if ("principals".equals(fieldName)) { + List principals = reader.readArray(reader1 -> Principal.fromJson(reader1)); + deserializedMaintenanceModeConfigurationPatchModel.principals = principals; + } else if ("justification".equals(fieldName)) { + deserializedMaintenanceModeConfigurationPatchModel.justification + = MaintenanceModeConfigurationModelJustification.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMaintenanceModeConfigurationPatchModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedOnBehalfOfConfiguration.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedOnBehalfOfConfiguration.java new file mode 100644 index 000000000000..70ed22cb40d8 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedOnBehalfOfConfiguration.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Managed-On-Behalf-Of configuration properties. This configuration exists for the resources where a resource provider + * manages those resources on behalf of the resource owner. + */ +@Immutable +public final class ManagedOnBehalfOfConfiguration implements JsonSerializable { + /* + * Managed-On-Behalf-Of broker resources + */ + private List moboBrokerResources; + + /** + * Creates an instance of ManagedOnBehalfOfConfiguration class. + */ + private ManagedOnBehalfOfConfiguration() { + } + + /** + * Get the moboBrokerResources property: Managed-On-Behalf-Of broker resources. + * + * @return the moboBrokerResources value. + */ + public List moboBrokerResources() { + return this.moboBrokerResources; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedOnBehalfOfConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedOnBehalfOfConfiguration if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ManagedOnBehalfOfConfiguration. + */ + public static ManagedOnBehalfOfConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedOnBehalfOfConfiguration deserializedManagedOnBehalfOfConfiguration + = new ManagedOnBehalfOfConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("moboBrokerResources".equals(fieldName)) { + List moboBrokerResources + = reader.readArray(reader1 -> MoboBrokerResource.fromJson(reader1)); + deserializedManagedOnBehalfOfConfiguration.moboBrokerResources = moboBrokerResources; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedOnBehalfOfConfiguration; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedServiceIdentity.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..acaf8906dd8b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedServiceIdentity.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private String principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private String tenantId; + + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId = reader.getString(); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedServiceIdentityType.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..00931d511097 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * No managed identity. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * System assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * User assigned managed identity. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * System and user assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MandatoryApprover.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MandatoryApprover.java new file mode 100644 index 000000000000..05d8809cc3fa --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MandatoryApprover.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Approver Metadata for approvals request. + */ +@Fluent +public final class MandatoryApprover implements JsonSerializable { + /* + * EntraId of the approver + */ + private String approverEntraId; + + /** + * Creates an instance of MandatoryApprover class. + */ + public MandatoryApprover() { + } + + /** + * Get the approverEntraId property: EntraId of the approver. + * + * @return the approverEntraId value. + */ + public String approverEntraId() { + return this.approverEntraId; + } + + /** + * Set the approverEntraId property: EntraId of the approver. + * + * @param approverEntraId the approverEntraId value to set. + * @return the MandatoryApprover object itself. + */ + public MandatoryApprover withApproverEntraId(String approverEntraId) { + this.approverEntraId = approverEntraId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("approverEntraId", this.approverEntraId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MandatoryApprover from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MandatoryApprover if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MandatoryApprover. + */ + public static MandatoryApprover fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MandatoryApprover deserializedMandatoryApprover = new MandatoryApprover(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("approverEntraId".equals(fieldName)) { + deserializedMandatoryApprover.approverEntraId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMandatoryApprover; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MoboBrokerResource.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MoboBrokerResource.java new file mode 100644 index 000000000000..99b32583cccf --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/MoboBrokerResource.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Managed-On-Behalf-Of broker resource. This resource is created by the Resource Provider to manage some resources on + * behalf of the user. + */ +@Immutable +public final class MoboBrokerResource implements JsonSerializable { + /* + * Resource identifier of a Managed-On-Behalf-Of broker resource + */ + private String id; + + /** + * Creates an instance of MoboBrokerResource class. + */ + private MoboBrokerResource() { + } + + /** + * Get the id property: Resource identifier of a Managed-On-Behalf-Of broker resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MoboBrokerResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MoboBrokerResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MoboBrokerResource. + */ + public static MoboBrokerResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MoboBrokerResource deserializedMoboBrokerResource = new MoboBrokerResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMoboBrokerResource.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMoboBrokerResource; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Operation.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Operation.java new file mode 100644 index 000000000000..4337dd33b083 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.resourcemanager.virtualenclaves.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.virtualenclaves.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/OperationDisplay.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/OperationDisplay.java new file mode 100644 index 000000000000..c5bc0fb1f8e3 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for and operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Operations.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Operations.java new file mode 100644 index 000000000000..ac9a572681ef --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Origin.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Origin.java new file mode 100644 index 000000000000..1825421e36f0 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Principal.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Principal.java new file mode 100644 index 000000000000..b5975cb0c8f0 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Principal.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Principal for maintenance mode or role assignments. + */ +@Fluent +public final class Principal implements JsonSerializable { + /* + * The object id associated with the principal + */ + private String id; + + /* + * The type of the object id. We currently allow users, groups, and service principals + */ + private PrincipalType type; + + /** + * Creates an instance of Principal class. + */ + public Principal() { + } + + /** + * Get the id property: The object id associated with the principal. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The object id associated with the principal. + * + * @param id the id value to set. + * @return the Principal object itself. + */ + public Principal withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type property: The type of the object id. We currently allow users, groups, and service principals. + * + * @return the type value. + */ + public PrincipalType type() { + return this.type; + } + + /** + * Set the type property: The type of the object id. We currently allow users, groups, and service principals. + * + * @param type the type value to set. + * @return the Principal object itself. + */ + public Principal withType(PrincipalType type) { + this.type = type; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Principal from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Principal if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Principal. + */ + public static Principal fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Principal deserializedPrincipal = new Principal(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrincipal.id = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrincipal.type = PrincipalType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPrincipal; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/PrincipalType.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/PrincipalType.java new file mode 100644 index 000000000000..90d9d98abe6d --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/PrincipalType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for PrincipalType. + */ +public final class PrincipalType extends ExpandableStringEnum { + /** + * Static value User for PrincipalType. + */ + public static final PrincipalType USER = fromString("User"); + + /** + * Static value Group for PrincipalType. + */ + public static final PrincipalType GROUP = fromString("Group"); + + /** + * Static value ServicePrincipal for PrincipalType. + */ + public static final PrincipalType SERVICE_PRINCIPAL = fromString("ServicePrincipal"); + + /** + * Creates a new instance of PrincipalType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrincipalType() { + } + + /** + * Creates or finds a PrincipalType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrincipalType. + */ + public static PrincipalType fromString(String name) { + return fromString(name, PrincipalType.class); + } + + /** + * Gets known PrincipalType values. + * + * @return known PrincipalType values. + */ + public static Collection values() { + return values(PrincipalType.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ProvisioningState.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ProvisioningState.java new file mode 100644 index 000000000000..43fcb148ec24 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ProvisioningState.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning status of the resource. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Provisioning State Type Accepted. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Provisioning State Type Creating. + */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** + * Provisioning State Type Deleting. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Provisioning State Type NotSpecified. + */ + public static final ProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** + * Provisioning State Type Running. + */ + public static final ProvisioningState RUNNING = fromString("Running"); + + /** + * Provisioning State Type Updating. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/RequestMetadata.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/RequestMetadata.java new file mode 100644 index 000000000000..c49e0c814653 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/RequestMetadata.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request Metadata for approvals request. + */ +@Fluent +public final class RequestMetadata implements JsonSerializable { + /* + * Resource Action of the item being approved or declined. + */ + private String resourceAction; + + /* + * Route name for the approval callback + */ + private String approvalCallbackRoute; + + /* + * Payload to be sent upon any action on approval request + */ + private String approvalCallbackPayload; + + /* + * Status of the approval. Uses ApprovalStatus enum. + */ + private ApprovalStatus approvalStatus; + + /** + * Creates an instance of RequestMetadata class. + */ + public RequestMetadata() { + } + + /** + * Get the resourceAction property: Resource Action of the item being approved or declined. + * + * @return the resourceAction value. + */ + public String resourceAction() { + return this.resourceAction; + } + + /** + * Set the resourceAction property: Resource Action of the item being approved or declined. + * + * @param resourceAction the resourceAction value to set. + * @return the RequestMetadata object itself. + */ + public RequestMetadata withResourceAction(String resourceAction) { + this.resourceAction = resourceAction; + return this; + } + + /** + * Get the approvalCallbackRoute property: Route name for the approval callback. + * + * @return the approvalCallbackRoute value. + */ + public String approvalCallbackRoute() { + return this.approvalCallbackRoute; + } + + /** + * Set the approvalCallbackRoute property: Route name for the approval callback. + * + * @param approvalCallbackRoute the approvalCallbackRoute value to set. + * @return the RequestMetadata object itself. + */ + public RequestMetadata withApprovalCallbackRoute(String approvalCallbackRoute) { + this.approvalCallbackRoute = approvalCallbackRoute; + return this; + } + + /** + * Get the approvalCallbackPayload property: Payload to be sent upon any action on approval request. + * + * @return the approvalCallbackPayload value. + */ + public String approvalCallbackPayload() { + return this.approvalCallbackPayload; + } + + /** + * Set the approvalCallbackPayload property: Payload to be sent upon any action on approval request. + * + * @param approvalCallbackPayload the approvalCallbackPayload value to set. + * @return the RequestMetadata object itself. + */ + public RequestMetadata withApprovalCallbackPayload(String approvalCallbackPayload) { + this.approvalCallbackPayload = approvalCallbackPayload; + return this; + } + + /** + * Get the approvalStatus property: Status of the approval. Uses ApprovalStatus enum. + * + * @return the approvalStatus value. + */ + public ApprovalStatus approvalStatus() { + return this.approvalStatus; + } + + /** + * Set the approvalStatus property: Status of the approval. Uses ApprovalStatus enum. + * + * @param approvalStatus the approvalStatus value to set. + * @return the RequestMetadata object itself. + */ + public RequestMetadata withApprovalStatus(ApprovalStatus approvalStatus) { + this.approvalStatus = approvalStatus; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceAction", this.resourceAction); + jsonWriter.writeStringField("approvalCallbackRoute", this.approvalCallbackRoute); + jsonWriter.writeStringField("approvalCallbackPayload", this.approvalCallbackPayload); + jsonWriter.writeStringField("approvalStatus", + this.approvalStatus == null ? null : this.approvalStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequestMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequestMetadata if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RequestMetadata. + */ + public static RequestMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RequestMetadata deserializedRequestMetadata = new RequestMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceAction".equals(fieldName)) { + deserializedRequestMetadata.resourceAction = reader.getString(); + } else if ("approvalCallbackRoute".equals(fieldName)) { + deserializedRequestMetadata.approvalCallbackRoute = reader.getString(); + } else if ("approvalCallbackPayload".equals(fieldName)) { + deserializedRequestMetadata.approvalCallbackPayload = reader.getString(); + } else if ("approvalStatus".equals(fieldName)) { + deserializedRequestMetadata.approvalStatus = ApprovalStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRequestMetadata; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/RequestMetadataUpdatableProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/RequestMetadataUpdatableProperties.java new file mode 100644 index 000000000000..0f9eae0e3e97 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/RequestMetadataUpdatableProperties.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Request Metadata patch properties. + */ +@Fluent +public final class RequestMetadataUpdatableProperties implements JsonSerializable { + /* + * Resource Action of the item being approved or declined. + */ + private String resourceAction; + + /* + * Route name for the approval callback + */ + private String approvalCallbackRoute; + + /* + * Payload to be sent upon any action on approval request + */ + private String approvalCallbackPayload; + + /* + * Status of the approval. Uses ApprovalStatus enum. + */ + private ApprovalStatus approvalStatus; + + /** + * Creates an instance of RequestMetadataUpdatableProperties class. + */ + public RequestMetadataUpdatableProperties() { + } + + /** + * Get the resourceAction property: Resource Action of the item being approved or declined. + * + * @return the resourceAction value. + */ + public String resourceAction() { + return this.resourceAction; + } + + /** + * Set the resourceAction property: Resource Action of the item being approved or declined. + * + * @param resourceAction the resourceAction value to set. + * @return the RequestMetadataUpdatableProperties object itself. + */ + public RequestMetadataUpdatableProperties withResourceAction(String resourceAction) { + this.resourceAction = resourceAction; + return this; + } + + /** + * Get the approvalCallbackRoute property: Route name for the approval callback. + * + * @return the approvalCallbackRoute value. + */ + public String approvalCallbackRoute() { + return this.approvalCallbackRoute; + } + + /** + * Set the approvalCallbackRoute property: Route name for the approval callback. + * + * @param approvalCallbackRoute the approvalCallbackRoute value to set. + * @return the RequestMetadataUpdatableProperties object itself. + */ + public RequestMetadataUpdatableProperties withApprovalCallbackRoute(String approvalCallbackRoute) { + this.approvalCallbackRoute = approvalCallbackRoute; + return this; + } + + /** + * Get the approvalCallbackPayload property: Payload to be sent upon any action on approval request. + * + * @return the approvalCallbackPayload value. + */ + public String approvalCallbackPayload() { + return this.approvalCallbackPayload; + } + + /** + * Set the approvalCallbackPayload property: Payload to be sent upon any action on approval request. + * + * @param approvalCallbackPayload the approvalCallbackPayload value to set. + * @return the RequestMetadataUpdatableProperties object itself. + */ + public RequestMetadataUpdatableProperties withApprovalCallbackPayload(String approvalCallbackPayload) { + this.approvalCallbackPayload = approvalCallbackPayload; + return this; + } + + /** + * Get the approvalStatus property: Status of the approval. Uses ApprovalStatus enum. + * + * @return the approvalStatus value. + */ + public ApprovalStatus approvalStatus() { + return this.approvalStatus; + } + + /** + * Set the approvalStatus property: Status of the approval. Uses ApprovalStatus enum. + * + * @param approvalStatus the approvalStatus value to set. + * @return the RequestMetadataUpdatableProperties object itself. + */ + public RequestMetadataUpdatableProperties withApprovalStatus(ApprovalStatus approvalStatus) { + this.approvalStatus = approvalStatus; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceAction", this.resourceAction); + jsonWriter.writeStringField("approvalCallbackRoute", this.approvalCallbackRoute); + jsonWriter.writeStringField("approvalCallbackPayload", this.approvalCallbackPayload); + jsonWriter.writeStringField("approvalStatus", + this.approvalStatus == null ? null : this.approvalStatus.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequestMetadataUpdatableProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequestMetadataUpdatableProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RequestMetadataUpdatableProperties. + */ + public static RequestMetadataUpdatableProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RequestMetadataUpdatableProperties deserializedRequestMetadataUpdatableProperties + = new RequestMetadataUpdatableProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceAction".equals(fieldName)) { + deserializedRequestMetadataUpdatableProperties.resourceAction = reader.getString(); + } else if ("approvalCallbackRoute".equals(fieldName)) { + deserializedRequestMetadataUpdatableProperties.approvalCallbackRoute = reader.getString(); + } else if ("approvalCallbackPayload".equals(fieldName)) { + deserializedRequestMetadataUpdatableProperties.approvalCallbackPayload = reader.getString(); + } else if ("approvalStatus".equals(fieldName)) { + deserializedRequestMetadataUpdatableProperties.approvalStatus + = ApprovalStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedRequestMetadataUpdatableProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/RoleAssignmentItem.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/RoleAssignmentItem.java new file mode 100644 index 000000000000..aaa3515fbfd6 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/RoleAssignmentItem.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Role assignment item that indicates which principals should be assigned this role definition. + */ +@Fluent +public final class RoleAssignmentItem implements JsonSerializable { + /* + * Role definition identifier + */ + private String roleDefinitionId; + + /* + * List of principal IDs to which to assign this role definition + */ + private List principals; + + /** + * Creates an instance of RoleAssignmentItem class. + */ + public RoleAssignmentItem() { + } + + /** + * Get the roleDefinitionId property: Role definition identifier. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: Role definition identifier. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the RoleAssignmentItem object itself. + */ + public RoleAssignmentItem withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; + } + + /** + * Get the principals property: List of principal IDs to which to assign this role definition. + * + * @return the principals value. + */ + public List principals() { + return this.principals; + } + + /** + * Set the principals property: List of principal IDs to which to assign this role definition. + * + * @param principals the principals value to set. + * @return the RoleAssignmentItem object itself. + */ + public RoleAssignmentItem withPrincipals(List principals) { + this.principals = principals; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("roleDefinitionId", this.roleDefinitionId); + jsonWriter.writeArrayField("principals", this.principals, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RoleAssignmentItem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RoleAssignmentItem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RoleAssignmentItem. + */ + public static RoleAssignmentItem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RoleAssignmentItem deserializedRoleAssignmentItem = new RoleAssignmentItem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("roleDefinitionId".equals(fieldName)) { + deserializedRoleAssignmentItem.roleDefinitionId = reader.getString(); + } else if ("principals".equals(fieldName)) { + List principals = reader.readArray(reader1 -> Principal.fromJson(reader1)); + deserializedRoleAssignmentItem.principals = principals; + } else { + reader.skipChildren(); + } + } + + return deserializedRoleAssignmentItem; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ServiceIdentifier.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ServiceIdentifier.java new file mode 100644 index 000000000000..304b9f5449b3 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/ServiceIdentifier.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Identifier for governed services. + */ +public final class ServiceIdentifier extends ExpandableStringEnum { + /** + * Service identifier for AKS. + */ + public static final ServiceIdentifier AKS = fromString("AKS"); + + /** + * Service identifier for App Service. + */ + public static final ServiceIdentifier APP_SERVICE = fromString("AppService"); + + /** + * Service identifier for Azure Firewalls. + */ + public static final ServiceIdentifier AZURE_FIREWALLS = fromString("AzureFirewalls"); + + /** + * Service identifier for Container Registry. + */ + public static final ServiceIdentifier CONTAINER_REGISTRY = fromString("ContainerRegistry"); + + /** + * Service identifier for CosmosDB. + */ + public static final ServiceIdentifier COSMOS_DB = fromString("CosmosDB"); + + /** + * Service identifier for Data Connectors. + */ + public static final ServiceIdentifier DATA_CONNECTORS = fromString("DataConnectors"); + + /** + * Service identifier for Insights. + */ + public static final ServiceIdentifier INSIGHTS = fromString("Insights"); + + /** + * Service identifier for Key Vault. + */ + public static final ServiceIdentifier KEY_VAULT = fromString("KeyVault"); + + /** + * Service identifier for Logic. + */ + public static final ServiceIdentifier LOGIC = fromString("Logic"); + + /** + * Service identifier for Microsoft SQL. + */ + public static final ServiceIdentifier MICROSOFT_SQL = fromString("MicrosoftSQL"); + + /** + * Service identifier for Monitoring. + */ + public static final ServiceIdentifier MONITORING = fromString("Monitoring"); + + /** + * Service identifier for PostgreSQL. + */ + public static final ServiceIdentifier POSTGRE_SQL = fromString("PostgreSQL"); + + /** + * Service identifier for Private DNS Zones. + */ + public static final ServiceIdentifier PRIVATE_DNSZONES = fromString("PrivateDNSZones"); + + /** + * Service identifier for Service Bus. + */ + public static final ServiceIdentifier SERVICE_BUS = fromString("ServiceBus"); + + /** + * Service identifier for Storage. + */ + public static final ServiceIdentifier STORAGE = fromString("Storage"); + + /** + * Creates a new instance of ServiceIdentifier value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServiceIdentifier() { + } + + /** + * Creates or finds a ServiceIdentifier from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServiceIdentifier. + */ + public static ServiceIdentifier fromString(String name) { + return fromString(name, ServiceIdentifier.class); + } + + /** + * Gets known ServiceIdentifier values. + * + * @return known ServiceIdentifier values. + */ + public static Collection values() { + return values(ServiceIdentifier.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/SubnetConfiguration.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/SubnetConfiguration.java new file mode 100644 index 000000000000..ab46260514e6 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/SubnetConfiguration.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Subnet Configuration. + */ +@Fluent +public final class SubnetConfiguration implements JsonSerializable { + /* + * Subnet name. + */ + private String subnetName; + + /* + * Subnet Resource ID. + */ + private String subnetResourceId; + + /* + * Network prefix size. + */ + private int networkPrefixSize; + + /* + * Subnet delegation. + */ + private String subnetDelegation; + + /* + * Address prefix. + */ + private String addressPrefix; + + /* + * Network security group ID. + */ + private String networkSecurityGroupResourceId; + + /** + * Creates an instance of SubnetConfiguration class. + */ + public SubnetConfiguration() { + } + + /** + * Get the subnetName property: Subnet name. + * + * @return the subnetName value. + */ + public String subnetName() { + return this.subnetName; + } + + /** + * Set the subnetName property: Subnet name. + * + * @param subnetName the subnetName value to set. + * @return the SubnetConfiguration object itself. + */ + public SubnetConfiguration withSubnetName(String subnetName) { + this.subnetName = subnetName; + return this; + } + + /** + * Get the subnetResourceId property: Subnet Resource ID. + * + * @return the subnetResourceId value. + */ + public String subnetResourceId() { + return this.subnetResourceId; + } + + /** + * Get the networkPrefixSize property: Network prefix size. + * + * @return the networkPrefixSize value. + */ + public int networkPrefixSize() { + return this.networkPrefixSize; + } + + /** + * Set the networkPrefixSize property: Network prefix size. + * + * @param networkPrefixSize the networkPrefixSize value to set. + * @return the SubnetConfiguration object itself. + */ + public SubnetConfiguration withNetworkPrefixSize(int networkPrefixSize) { + this.networkPrefixSize = networkPrefixSize; + return this; + } + + /** + * Get the subnetDelegation property: Subnet delegation. + * + * @return the subnetDelegation value. + */ + public String subnetDelegation() { + return this.subnetDelegation; + } + + /** + * Set the subnetDelegation property: Subnet delegation. + * + * @param subnetDelegation the subnetDelegation value to set. + * @return the SubnetConfiguration object itself. + */ + public SubnetConfiguration withSubnetDelegation(String subnetDelegation) { + this.subnetDelegation = subnetDelegation; + return this; + } + + /** + * Get the addressPrefix property: Address prefix. + * + * @return the addressPrefix value. + */ + public String addressPrefix() { + return this.addressPrefix; + } + + /** + * Get the networkSecurityGroupResourceId property: Network security group ID. + * + * @return the networkSecurityGroupResourceId value. + */ + public String networkSecurityGroupResourceId() { + return this.networkSecurityGroupResourceId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subnetName", this.subnetName); + jsonWriter.writeIntField("networkPrefixSize", this.networkPrefixSize); + jsonWriter.writeStringField("subnetDelegation", this.subnetDelegation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubnetConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubnetConfiguration if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SubnetConfiguration. + */ + public static SubnetConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubnetConfiguration deserializedSubnetConfiguration = new SubnetConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subnetName".equals(fieldName)) { + deserializedSubnetConfiguration.subnetName = reader.getString(); + } else if ("networkPrefixSize".equals(fieldName)) { + deserializedSubnetConfiguration.networkPrefixSize = reader.getInt(); + } else if ("subnetResourceId".equals(fieldName)) { + deserializedSubnetConfiguration.subnetResourceId = reader.getString(); + } else if ("subnetDelegation".equals(fieldName)) { + deserializedSubnetConfiguration.subnetDelegation = reader.getString(); + } else if ("addressPrefix".equals(fieldName)) { + deserializedSubnetConfiguration.addressPrefix = reader.getString(); + } else if ("networkSecurityGroupResourceId".equals(fieldName)) { + deserializedSubnetConfiguration.networkSecurityGroupResourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubnetConfiguration; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubPatchModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubPatchModel.java new file mode 100644 index 000000000000..e95ac78c71ad --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubPatchModel.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * TH Patch Resource. + */ +@Fluent +public final class TransitHubPatchModel implements JsonSerializable { + /* + * The TransitHub resource. + */ + private TransitHubPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of TransitHubPatchModel class. + */ + public TransitHubPatchModel() { + } + + /** + * Get the properties property: The TransitHub resource. + * + * @return the properties value. + */ + public TransitHubPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The TransitHub resource. + * + * @param properties the properties value to set. + * @return the TransitHubPatchModel object itself. + */ + public TransitHubPatchModel withProperties(TransitHubPatchProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TransitHubPatchModel object itself. + */ + public TransitHubPatchModel withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TransitHubPatchModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TransitHubPatchModel if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TransitHubPatchModel. + */ + public static TransitHubPatchModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TransitHubPatchModel deserializedTransitHubPatchModel = new TransitHubPatchModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedTransitHubPatchModel.properties = TransitHubPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTransitHubPatchModel.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedTransitHubPatchModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubPatchProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubPatchProperties.java new file mode 100644 index 000000000000..4fa2b5fd6494 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubPatchProperties.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Transit Hub patchable Properties. + */ +@Fluent +public final class TransitHubPatchProperties implements JsonSerializable { + /* + * The state of the transitHub. + */ + private TransitHubState state; + + /* + * The TransitOption of the transitHub. + */ + private TransitOption transitOption; + + /** + * Creates an instance of TransitHubPatchProperties class. + */ + public TransitHubPatchProperties() { + } + + /** + * Get the state property: The state of the transitHub. + * + * @return the state value. + */ + public TransitHubState state() { + return this.state; + } + + /** + * Set the state property: The state of the transitHub. + * + * @param state the state value to set. + * @return the TransitHubPatchProperties object itself. + */ + public TransitHubPatchProperties withState(TransitHubState state) { + this.state = state; + return this; + } + + /** + * Get the transitOption property: The TransitOption of the transitHub. + * + * @return the transitOption value. + */ + public TransitOption transitOption() { + return this.transitOption; + } + + /** + * Set the transitOption property: The TransitOption of the transitHub. + * + * @param transitOption the transitOption value to set. + * @return the TransitHubPatchProperties object itself. + */ + public TransitHubPatchProperties withTransitOption(TransitOption transitOption) { + this.transitOption = transitOption; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeJsonField("transitOption", this.transitOption); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TransitHubPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TransitHubPatchProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TransitHubPatchProperties. + */ + public static TransitHubPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TransitHubPatchProperties deserializedTransitHubPatchProperties = new TransitHubPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedTransitHubPatchProperties.state = TransitHubState.fromString(reader.getString()); + } else if ("transitOption".equals(fieldName)) { + deserializedTransitHubPatchProperties.transitOption = TransitOption.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTransitHubPatchProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubProperties.java new file mode 100644 index 000000000000..94caedf04286 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubProperties.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Describes the properties of an Transit Hub. + */ +@Fluent +public final class TransitHubProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * The state of the transitHub. + */ + private TransitHubState state; + + /* + * The TransitOption of the transitHub. + */ + private TransitOption transitOption; + + /* + * List of resource ids modified by transitHubs. + */ + private List resourceCollection; + + /** + * Creates an instance of TransitHubProperties class. + */ + public TransitHubProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the state property: The state of the transitHub. + * + * @return the state value. + */ + public TransitHubState state() { + return this.state; + } + + /** + * Set the state property: The state of the transitHub. + * + * @param state the state value to set. + * @return the TransitHubProperties object itself. + */ + public TransitHubProperties withState(TransitHubState state) { + this.state = state; + return this; + } + + /** + * Get the transitOption property: The TransitOption of the transitHub. + * + * @return the transitOption value. + */ + public TransitOption transitOption() { + return this.transitOption; + } + + /** + * Set the transitOption property: The TransitOption of the transitHub. + * + * @param transitOption the transitOption value to set. + * @return the TransitHubProperties object itself. + */ + public TransitHubProperties withTransitOption(TransitOption transitOption) { + this.transitOption = transitOption; + return this; + } + + /** + * Get the resourceCollection property: List of resource ids modified by transitHubs. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.resourceCollection; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeJsonField("transitOption", this.transitOption); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TransitHubProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TransitHubProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TransitHubProperties. + */ + public static TransitHubProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TransitHubProperties deserializedTransitHubProperties = new TransitHubProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedTransitHubProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("state".equals(fieldName)) { + deserializedTransitHubProperties.state = TransitHubState.fromString(reader.getString()); + } else if ("transitOption".equals(fieldName)) { + deserializedTransitHubProperties.transitOption = TransitOption.fromJson(reader); + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedTransitHubProperties.resourceCollection = resourceCollection; + } else { + reader.skipChildren(); + } + } + + return deserializedTransitHubProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubResource.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubResource.java new file mode 100644 index 000000000000..e9788f9e9be4 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubResource.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.TransitHubResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of TransitHubResource. + */ +public interface TransitHubResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + TransitHubProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.virtualenclaves.fluent.models.TransitHubResourceInner object. + * + * @return the inner object. + */ + TransitHubResourceInner innerModel(); + + /** + * The entirety of the TransitHubResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The TransitHubResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the TransitHubResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the TransitHubResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the TransitHubResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, communityName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @return the next definition stage. + */ + WithCreate withExistingCommunity(String resourceGroupName, String communityName); + } + + /** + * The stage of the TransitHubResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + TransitHubResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TransitHubResource create(Context context); + } + + /** + * The stage of the TransitHubResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the TransitHubResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(TransitHubProperties properties); + } + } + + /** + * Begins update for the TransitHubResource resource. + * + * @return the stage of resource update. + */ + TransitHubResource.Update update(); + + /** + * The template for TransitHubResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TransitHubResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TransitHubResource apply(Context context); + } + + /** + * The TransitHubResource update stages. + */ + interface UpdateStages { + /** + * The stage of the TransitHubResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the TransitHubResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The TransitHub resource.. + * + * @param properties The TransitHub resource. + * @return the next definition stage. + */ + Update withProperties(TransitHubPatchProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TransitHubResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TransitHubResource refresh(Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubState.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubState.java new file mode 100644 index 000000000000..4e890d3ad726 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubState.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the state of the transitHub. + */ +public final class TransitHubState extends ExpandableStringEnum { + /** + * TransitHubState Type PendingApproval. + */ + public static final TransitHubState PENDING_APPROVAL = fromString("PendingApproval"); + + /** + * TransitHubState Type Approved. + */ + public static final TransitHubState APPROVED = fromString("Approved"); + + /** + * TransitHubState Type PendingUpdate. + */ + public static final TransitHubState PENDING_UPDATE = fromString("PendingUpdate"); + + /** + * TransitHubState Type Active. + */ + public static final TransitHubState ACTIVE = fromString("Active"); + + /** + * TransitHubState Type Failed. + */ + public static final TransitHubState FAILED = fromString("Failed"); + + /** + * Creates a new instance of TransitHubState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TransitHubState() { + } + + /** + * Creates or finds a TransitHubState from its string representation. + * + * @param name a name to look for. + * @return the corresponding TransitHubState. + */ + public static TransitHubState fromString(String name) { + return fromString(name, TransitHubState.class); + } + + /** + * Gets known TransitHubState values. + * + * @return known TransitHubState values. + */ + public static Collection values() { + return values(TransitHubState.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubs.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubs.java new file mode 100644 index 000000000000..4b205fc9975b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubs.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of TransitHubs. + */ +public interface TransitHubs { + /** + * Get a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TransitHubResource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String communityName, String transitHubName, + Context context); + + /** + * Get a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TransitHubResource. + */ + TransitHubResource get(String resourceGroupName, String communityName, String transitHubName); + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String communityName, String transitHubName); + + /** + * Delete a TransitHubResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param transitHubName The name of the TransitHub Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String communityName, String transitHubName, Context context); + + /** + * List TransitHubResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCommunityResource(String resourceGroupName, String communityName); + + /** + * List TransitHubResource resources by CommunityResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCommunityResource(String resourceGroupName, String communityName, + Context context); + + /** + * List TransitHubResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(String communityName); + + /** + * List TransitHubResource resources by subscription ID. + * + * @param communityName The name of the communityResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TransitHubResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(String communityName, Context context); + + /** + * Get a TransitHubResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TransitHubResource along with {@link Response}. + */ + TransitHubResource getById(String id); + + /** + * Get a TransitHubResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TransitHubResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a TransitHubResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a TransitHubResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TransitHubResource resource. + * + * @param name resource name. + * @return the first stage of the new TransitHubResource definition. + */ + TransitHubResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOption.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOption.java new file mode 100644 index 000000000000..6fa41fe41e01 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOption.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * TransitOption Properties. + */ +@Fluent +public final class TransitOption implements JsonSerializable { + /* + * Transit Option Type. + */ + private TransitOptionType type; + + /* + * Transit Option Params + */ + private TransitOptionParams params; + + /** + * Creates an instance of TransitOption class. + */ + public TransitOption() { + } + + /** + * Get the type property: Transit Option Type. + * + * @return the type value. + */ + public TransitOptionType type() { + return this.type; + } + + /** + * Set the type property: Transit Option Type. + * + * @param type the type value to set. + * @return the TransitOption object itself. + */ + public TransitOption withType(TransitOptionType type) { + this.type = type; + return this; + } + + /** + * Get the params property: Transit Option Params. + * + * @return the params value. + */ + public TransitOptionParams params() { + return this.params; + } + + /** + * Set the params property: Transit Option Params. + * + * @param params the params value to set. + * @return the TransitOption object itself. + */ + public TransitOption withParams(TransitOptionParams params) { + this.params = params; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeJsonField("params", this.params); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TransitOption from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TransitOption if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TransitOption. + */ + public static TransitOption fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TransitOption deserializedTransitOption = new TransitOption(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedTransitOption.type = TransitOptionType.fromString(reader.getString()); + } else if ("params".equals(fieldName)) { + deserializedTransitOption.params = TransitOptionParams.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTransitOption; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOptionParams.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOptionParams.java new file mode 100644 index 000000000000..34050d7117d2 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOptionParams.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * TransitOptionParams Properties. + */ +@Fluent +public final class TransitOptionParams implements JsonSerializable { + /* + * Transit Option Params scaleUnits. + */ + private Long scaleUnits; + + /* + * Transit Option Params remoteVirtualNetworkId. + */ + private String remoteVirtualNetworkId; + + /** + * Creates an instance of TransitOptionParams class. + */ + public TransitOptionParams() { + } + + /** + * Get the scaleUnits property: Transit Option Params scaleUnits. + * + * @return the scaleUnits value. + */ + public Long scaleUnits() { + return this.scaleUnits; + } + + /** + * Set the scaleUnits property: Transit Option Params scaleUnits. + * + * @param scaleUnits the scaleUnits value to set. + * @return the TransitOptionParams object itself. + */ + public TransitOptionParams withScaleUnits(Long scaleUnits) { + this.scaleUnits = scaleUnits; + return this; + } + + /** + * Get the remoteVirtualNetworkId property: Transit Option Params remoteVirtualNetworkId. + * + * @return the remoteVirtualNetworkId value. + */ + public String remoteVirtualNetworkId() { + return this.remoteVirtualNetworkId; + } + + /** + * Set the remoteVirtualNetworkId property: Transit Option Params remoteVirtualNetworkId. + * + * @param remoteVirtualNetworkId the remoteVirtualNetworkId value to set. + * @return the TransitOptionParams object itself. + */ + public TransitOptionParams withRemoteVirtualNetworkId(String remoteVirtualNetworkId) { + this.remoteVirtualNetworkId = remoteVirtualNetworkId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("scaleUnits", this.scaleUnits); + jsonWriter.writeStringField("remoteVirtualNetworkId", this.remoteVirtualNetworkId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TransitOptionParams from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TransitOptionParams if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TransitOptionParams. + */ + public static TransitOptionParams fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TransitOptionParams deserializedTransitOptionParams = new TransitOptionParams(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("scaleUnits".equals(fieldName)) { + deserializedTransitOptionParams.scaleUnits = reader.getNullable(JsonReader::getLong); + } else if ("remoteVirtualNetworkId".equals(fieldName)) { + deserializedTransitOptionParams.remoteVirtualNetworkId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTransitOptionParams; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOptionType.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOptionType.java new file mode 100644 index 000000000000..e6d16f1f0ee9 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOptionType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the type of the transitOption. + */ +public final class TransitOptionType extends ExpandableStringEnum { + /** + * TransitOptionType ExpressRoute. + */ + public static final TransitOptionType EXPRESS_ROUTE = fromString("ExpressRoute"); + + /** + * TransitOptionType Gateway. + */ + public static final TransitOptionType GATEWAY = fromString("Gateway"); + + /** + * TransitOptionType Peering. + */ + public static final TransitOptionType PEERING = fromString("Peering"); + + /** + * Creates a new instance of TransitOptionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TransitOptionType() { + } + + /** + * Creates or finds a TransitOptionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TransitOptionType. + */ + public static TransitOptionType fromString(String name) { + return fromString(name, TransitOptionType.class); + } + + /** + * Gets known TransitOptionType values. + * + * @return known TransitOptionType values. + */ + public static Collection values() { + return values(TransitOptionType.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/UserAssignedIdentity.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..f5b1e049af55 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/UserAssignedIdentity.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private String principalId; + + /* + * The client ID of the assigned identity. + */ + private String clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclavePatchModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclavePatchModel.java new file mode 100644 index 000000000000..cee37a100cbc --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclavePatchModel.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Virtual Enclave Patch Model. + */ +@Fluent +public final class VirtualEnclavePatchModel implements JsonSerializable { + /* + * Virtual Enclave Patch properties + */ + private VirtualEnclavePatchProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of VirtualEnclavePatchModel class. + */ + public VirtualEnclavePatchModel() { + } + + /** + * Get the properties property: Virtual Enclave Patch properties. + * + * @return the properties value. + */ + public VirtualEnclavePatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Virtual Enclave Patch properties. + * + * @param properties the properties value to set. + * @return the VirtualEnclavePatchModel object itself. + */ + public VirtualEnclavePatchModel withProperties(VirtualEnclavePatchProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the VirtualEnclavePatchModel object itself. + */ + public VirtualEnclavePatchModel withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the VirtualEnclavePatchModel object itself. + */ + public VirtualEnclavePatchModel withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualEnclavePatchModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualEnclavePatchModel if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the VirtualEnclavePatchModel. + */ + public static VirtualEnclavePatchModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualEnclavePatchModel deserializedVirtualEnclavePatchModel = new VirtualEnclavePatchModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedVirtualEnclavePatchModel.properties = VirtualEnclavePatchProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedVirtualEnclavePatchModel.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedVirtualEnclavePatchModel.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualEnclavePatchModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclavePatchProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclavePatchProperties.java new file mode 100644 index 000000000000..c2f2337bfa4f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclavePatchProperties.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Virtual Enclave Patchable Properties. + */ +@Fluent +public final class VirtualEnclavePatchProperties implements JsonSerializable { + /* + * Virtual Network. + */ + private EnclaveVirtualNetworkModel enclaveVirtualNetwork; + + /* + * Deploy Bastion service (True or False). + */ + private Boolean bastionEnabled; + + /* + * Enclave role assignments + */ + private List enclaveRoleAssignments; + + /* + * Workload role assignments + */ + private List workloadRoleAssignments; + + /* + * Enclave specific policies + */ + private List governedServiceList; + + /* + * Enclave default settings. + */ + private EnclaveDefaultSettingsPatchModel enclaveDefaultSettings; + + /* + * Maintenance Mode configuration. + */ + private MaintenanceModeConfigurationPatchModel maintenanceModeConfiguration; + + /** + * Creates an instance of VirtualEnclavePatchProperties class. + */ + public VirtualEnclavePatchProperties() { + } + + /** + * Get the enclaveVirtualNetwork property: Virtual Network. + * + * @return the enclaveVirtualNetwork value. + */ + public EnclaveVirtualNetworkModel enclaveVirtualNetwork() { + return this.enclaveVirtualNetwork; + } + + /** + * Set the enclaveVirtualNetwork property: Virtual Network. + * + * @param enclaveVirtualNetwork the enclaveVirtualNetwork value to set. + * @return the VirtualEnclavePatchProperties object itself. + */ + public VirtualEnclavePatchProperties withEnclaveVirtualNetwork(EnclaveVirtualNetworkModel enclaveVirtualNetwork) { + this.enclaveVirtualNetwork = enclaveVirtualNetwork; + return this; + } + + /** + * Get the bastionEnabled property: Deploy Bastion service (True or False). + * + * @return the bastionEnabled value. + */ + public Boolean bastionEnabled() { + return this.bastionEnabled; + } + + /** + * Set the bastionEnabled property: Deploy Bastion service (True or False). + * + * @param bastionEnabled the bastionEnabled value to set. + * @return the VirtualEnclavePatchProperties object itself. + */ + public VirtualEnclavePatchProperties withBastionEnabled(Boolean bastionEnabled) { + this.bastionEnabled = bastionEnabled; + return this; + } + + /** + * Get the enclaveRoleAssignments property: Enclave role assignments. + * + * @return the enclaveRoleAssignments value. + */ + public List enclaveRoleAssignments() { + return this.enclaveRoleAssignments; + } + + /** + * Set the enclaveRoleAssignments property: Enclave role assignments. + * + * @param enclaveRoleAssignments the enclaveRoleAssignments value to set. + * @return the VirtualEnclavePatchProperties object itself. + */ + public VirtualEnclavePatchProperties withEnclaveRoleAssignments(List enclaveRoleAssignments) { + this.enclaveRoleAssignments = enclaveRoleAssignments; + return this; + } + + /** + * Get the workloadRoleAssignments property: Workload role assignments. + * + * @return the workloadRoleAssignments value. + */ + public List workloadRoleAssignments() { + return this.workloadRoleAssignments; + } + + /** + * Set the workloadRoleAssignments property: Workload role assignments. + * + * @param workloadRoleAssignments the workloadRoleAssignments value to set. + * @return the VirtualEnclavePatchProperties object itself. + */ + public VirtualEnclavePatchProperties withWorkloadRoleAssignments(List workloadRoleAssignments) { + this.workloadRoleAssignments = workloadRoleAssignments; + return this; + } + + /** + * Get the governedServiceList property: Enclave specific policies. + * + * @return the governedServiceList value. + */ + public List governedServiceList() { + return this.governedServiceList; + } + + /** + * Set the governedServiceList property: Enclave specific policies. + * + * @param governedServiceList the governedServiceList value to set. + * @return the VirtualEnclavePatchProperties object itself. + */ + public VirtualEnclavePatchProperties withGovernedServiceList(List governedServiceList) { + this.governedServiceList = governedServiceList; + return this; + } + + /** + * Get the enclaveDefaultSettings property: Enclave default settings. + * + * @return the enclaveDefaultSettings value. + */ + public EnclaveDefaultSettingsPatchModel enclaveDefaultSettings() { + return this.enclaveDefaultSettings; + } + + /** + * Set the enclaveDefaultSettings property: Enclave default settings. + * + * @param enclaveDefaultSettings the enclaveDefaultSettings value to set. + * @return the VirtualEnclavePatchProperties object itself. + */ + public VirtualEnclavePatchProperties + withEnclaveDefaultSettings(EnclaveDefaultSettingsPatchModel enclaveDefaultSettings) { + this.enclaveDefaultSettings = enclaveDefaultSettings; + return this; + } + + /** + * Get the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @return the maintenanceModeConfiguration value. + */ + public MaintenanceModeConfigurationPatchModel maintenanceModeConfiguration() { + return this.maintenanceModeConfiguration; + } + + /** + * Set the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @param maintenanceModeConfiguration the maintenanceModeConfiguration value to set. + * @return the VirtualEnclavePatchProperties object itself. + */ + public VirtualEnclavePatchProperties + withMaintenanceModeConfiguration(MaintenanceModeConfigurationPatchModel maintenanceModeConfiguration) { + this.maintenanceModeConfiguration = maintenanceModeConfiguration; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("enclaveVirtualNetwork", this.enclaveVirtualNetwork); + jsonWriter.writeBooleanField("bastionEnabled", this.bastionEnabled); + jsonWriter.writeArrayField("enclaveRoleAssignments", this.enclaveRoleAssignments, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("workloadRoleAssignments", this.workloadRoleAssignments, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("governedServiceList", this.governedServiceList, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("enclaveDefaultSettings", this.enclaveDefaultSettings); + jsonWriter.writeJsonField("maintenanceModeConfiguration", this.maintenanceModeConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualEnclavePatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualEnclavePatchProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VirtualEnclavePatchProperties. + */ + public static VirtualEnclavePatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualEnclavePatchProperties deserializedVirtualEnclavePatchProperties + = new VirtualEnclavePatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enclaveVirtualNetwork".equals(fieldName)) { + deserializedVirtualEnclavePatchProperties.enclaveVirtualNetwork + = EnclaveVirtualNetworkModel.fromJson(reader); + } else if ("bastionEnabled".equals(fieldName)) { + deserializedVirtualEnclavePatchProperties.bastionEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("enclaveRoleAssignments".equals(fieldName)) { + List enclaveRoleAssignments + = reader.readArray(reader1 -> RoleAssignmentItem.fromJson(reader1)); + deserializedVirtualEnclavePatchProperties.enclaveRoleAssignments = enclaveRoleAssignments; + } else if ("workloadRoleAssignments".equals(fieldName)) { + List workloadRoleAssignments + = reader.readArray(reader1 -> RoleAssignmentItem.fromJson(reader1)); + deserializedVirtualEnclavePatchProperties.workloadRoleAssignments = workloadRoleAssignments; + } else if ("governedServiceList".equals(fieldName)) { + List governedServiceList + = reader.readArray(reader1 -> GovernedServiceItem.fromJson(reader1)); + deserializedVirtualEnclavePatchProperties.governedServiceList = governedServiceList; + } else if ("enclaveDefaultSettings".equals(fieldName)) { + deserializedVirtualEnclavePatchProperties.enclaveDefaultSettings + = EnclaveDefaultSettingsPatchModel.fromJson(reader); + } else if ("maintenanceModeConfiguration".equals(fieldName)) { + deserializedVirtualEnclavePatchProperties.maintenanceModeConfiguration + = MaintenanceModeConfigurationPatchModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualEnclavePatchProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclaveProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclaveProperties.java new file mode 100644 index 000000000000..6687407e5bd8 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclaveProperties.java @@ -0,0 +1,380 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Virtual Enclave Resource properties. + */ +@Fluent +public final class VirtualEnclaveProperties implements JsonSerializable { + /* + * Provisioning State. + */ + private ProvisioningState provisioningState; + + /* + * Virtual Network. + */ + private EnclaveVirtualNetworkModel enclaveVirtualNetwork; + + /* + * Enclave Address Spaces + */ + private EnclaveAddressSpacesModel enclaveAddressSpaces; + + /* + * Community Resource Id. + */ + private String communityResourceId; + + /* + * List of resource ids created by Virtual Enclave. + */ + private List resourceCollection; + + /* + * Managed resource group name. + */ + private String managedResourceGroupName; + + /* + * Managed On Behalf Of Configuration. + */ + private ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration; + + /* + * Deploy Bastion service (True or False). + */ + private Boolean bastionEnabled; + + /* + * Enclave role assignments + */ + private List enclaveRoleAssignments; + + /* + * Workload role assignments + */ + private List workloadRoleAssignments; + + /* + * Enclave specific policies + */ + private List governedServiceList; + + /* + * Enclave default settings. + */ + private EnclaveDefaultSettingsModel enclaveDefaultSettings; + + /* + * Maintenance Mode configuration. + */ + private MaintenanceModeConfigurationModel maintenanceModeConfiguration; + + /** + * Creates an instance of VirtualEnclaveProperties class. + */ + public VirtualEnclaveProperties() { + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the enclaveVirtualNetwork property: Virtual Network. + * + * @return the enclaveVirtualNetwork value. + */ + public EnclaveVirtualNetworkModel enclaveVirtualNetwork() { + return this.enclaveVirtualNetwork; + } + + /** + * Set the enclaveVirtualNetwork property: Virtual Network. + * + * @param enclaveVirtualNetwork the enclaveVirtualNetwork value to set. + * @return the VirtualEnclaveProperties object itself. + */ + public VirtualEnclaveProperties withEnclaveVirtualNetwork(EnclaveVirtualNetworkModel enclaveVirtualNetwork) { + this.enclaveVirtualNetwork = enclaveVirtualNetwork; + return this; + } + + /** + * Get the enclaveAddressSpaces property: Enclave Address Spaces. + * + * @return the enclaveAddressSpaces value. + */ + public EnclaveAddressSpacesModel enclaveAddressSpaces() { + return this.enclaveAddressSpaces; + } + + /** + * Get the communityResourceId property: Community Resource Id. + * + * @return the communityResourceId value. + */ + public String communityResourceId() { + return this.communityResourceId; + } + + /** + * Set the communityResourceId property: Community Resource Id. + * + * @param communityResourceId the communityResourceId value to set. + * @return the VirtualEnclaveProperties object itself. + */ + public VirtualEnclaveProperties withCommunityResourceId(String communityResourceId) { + this.communityResourceId = communityResourceId; + return this; + } + + /** + * Get the resourceCollection property: List of resource ids created by Virtual Enclave. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.resourceCollection; + } + + /** + * Get the managedResourceGroupName property: Managed resource group name. + * + * @return the managedResourceGroupName value. + */ + public String managedResourceGroupName() { + return this.managedResourceGroupName; + } + + /** + * Get the managedOnBehalfOfConfiguration property: Managed On Behalf Of Configuration. + * + * @return the managedOnBehalfOfConfiguration value. + */ + public ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration() { + return this.managedOnBehalfOfConfiguration; + } + + /** + * Get the bastionEnabled property: Deploy Bastion service (True or False). + * + * @return the bastionEnabled value. + */ + public Boolean bastionEnabled() { + return this.bastionEnabled; + } + + /** + * Set the bastionEnabled property: Deploy Bastion service (True or False). + * + * @param bastionEnabled the bastionEnabled value to set. + * @return the VirtualEnclaveProperties object itself. + */ + public VirtualEnclaveProperties withBastionEnabled(Boolean bastionEnabled) { + this.bastionEnabled = bastionEnabled; + return this; + } + + /** + * Get the enclaveRoleAssignments property: Enclave role assignments. + * + * @return the enclaveRoleAssignments value. + */ + public List enclaveRoleAssignments() { + return this.enclaveRoleAssignments; + } + + /** + * Set the enclaveRoleAssignments property: Enclave role assignments. + * + * @param enclaveRoleAssignments the enclaveRoleAssignments value to set. + * @return the VirtualEnclaveProperties object itself. + */ + public VirtualEnclaveProperties withEnclaveRoleAssignments(List enclaveRoleAssignments) { + this.enclaveRoleAssignments = enclaveRoleAssignments; + return this; + } + + /** + * Get the workloadRoleAssignments property: Workload role assignments. + * + * @return the workloadRoleAssignments value. + */ + public List workloadRoleAssignments() { + return this.workloadRoleAssignments; + } + + /** + * Set the workloadRoleAssignments property: Workload role assignments. + * + * @param workloadRoleAssignments the workloadRoleAssignments value to set. + * @return the VirtualEnclaveProperties object itself. + */ + public VirtualEnclaveProperties withWorkloadRoleAssignments(List workloadRoleAssignments) { + this.workloadRoleAssignments = workloadRoleAssignments; + return this; + } + + /** + * Get the governedServiceList property: Enclave specific policies. + * + * @return the governedServiceList value. + */ + public List governedServiceList() { + return this.governedServiceList; + } + + /** + * Set the governedServiceList property: Enclave specific policies. + * + * @param governedServiceList the governedServiceList value to set. + * @return the VirtualEnclaveProperties object itself. + */ + public VirtualEnclaveProperties withGovernedServiceList(List governedServiceList) { + this.governedServiceList = governedServiceList; + return this; + } + + /** + * Get the enclaveDefaultSettings property: Enclave default settings. + * + * @return the enclaveDefaultSettings value. + */ + public EnclaveDefaultSettingsModel enclaveDefaultSettings() { + return this.enclaveDefaultSettings; + } + + /** + * Set the enclaveDefaultSettings property: Enclave default settings. + * + * @param enclaveDefaultSettings the enclaveDefaultSettings value to set. + * @return the VirtualEnclaveProperties object itself. + */ + public VirtualEnclaveProperties withEnclaveDefaultSettings(EnclaveDefaultSettingsModel enclaveDefaultSettings) { + this.enclaveDefaultSettings = enclaveDefaultSettings; + return this; + } + + /** + * Get the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @return the maintenanceModeConfiguration value. + */ + public MaintenanceModeConfigurationModel maintenanceModeConfiguration() { + return this.maintenanceModeConfiguration; + } + + /** + * Set the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @param maintenanceModeConfiguration the maintenanceModeConfiguration value to set. + * @return the VirtualEnclaveProperties object itself. + */ + public VirtualEnclaveProperties + withMaintenanceModeConfiguration(MaintenanceModeConfigurationModel maintenanceModeConfiguration) { + this.maintenanceModeConfiguration = maintenanceModeConfiguration; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("enclaveVirtualNetwork", this.enclaveVirtualNetwork); + jsonWriter.writeStringField("communityResourceId", this.communityResourceId); + jsonWriter.writeBooleanField("bastionEnabled", this.bastionEnabled); + jsonWriter.writeArrayField("enclaveRoleAssignments", this.enclaveRoleAssignments, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("workloadRoleAssignments", this.workloadRoleAssignments, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("governedServiceList", this.governedServiceList, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("enclaveDefaultSettings", this.enclaveDefaultSettings); + jsonWriter.writeJsonField("maintenanceModeConfiguration", this.maintenanceModeConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualEnclaveProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualEnclaveProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VirtualEnclaveProperties. + */ + public static VirtualEnclaveProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualEnclaveProperties deserializedVirtualEnclaveProperties = new VirtualEnclaveProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enclaveVirtualNetwork".equals(fieldName)) { + deserializedVirtualEnclaveProperties.enclaveVirtualNetwork + = EnclaveVirtualNetworkModel.fromJson(reader); + } else if ("communityResourceId".equals(fieldName)) { + deserializedVirtualEnclaveProperties.communityResourceId = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedVirtualEnclaveProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("enclaveAddressSpaces".equals(fieldName)) { + deserializedVirtualEnclaveProperties.enclaveAddressSpaces + = EnclaveAddressSpacesModel.fromJson(reader); + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedVirtualEnclaveProperties.resourceCollection = resourceCollection; + } else if ("managedResourceGroupName".equals(fieldName)) { + deserializedVirtualEnclaveProperties.managedResourceGroupName = reader.getString(); + } else if ("managedOnBehalfOfConfiguration".equals(fieldName)) { + deserializedVirtualEnclaveProperties.managedOnBehalfOfConfiguration + = ManagedOnBehalfOfConfiguration.fromJson(reader); + } else if ("bastionEnabled".equals(fieldName)) { + deserializedVirtualEnclaveProperties.bastionEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("enclaveRoleAssignments".equals(fieldName)) { + List enclaveRoleAssignments + = reader.readArray(reader1 -> RoleAssignmentItem.fromJson(reader1)); + deserializedVirtualEnclaveProperties.enclaveRoleAssignments = enclaveRoleAssignments; + } else if ("workloadRoleAssignments".equals(fieldName)) { + List workloadRoleAssignments + = reader.readArray(reader1 -> RoleAssignmentItem.fromJson(reader1)); + deserializedVirtualEnclaveProperties.workloadRoleAssignments = workloadRoleAssignments; + } else if ("governedServiceList".equals(fieldName)) { + List governedServiceList + = reader.readArray(reader1 -> GovernedServiceItem.fromJson(reader1)); + deserializedVirtualEnclaveProperties.governedServiceList = governedServiceList; + } else if ("enclaveDefaultSettings".equals(fieldName)) { + deserializedVirtualEnclaveProperties.enclaveDefaultSettings + = EnclaveDefaultSettingsModel.fromJson(reader); + } else if ("maintenanceModeConfiguration".equals(fieldName)) { + deserializedVirtualEnclaveProperties.maintenanceModeConfiguration + = MaintenanceModeConfigurationModel.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualEnclaveProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclaves.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclaves.java new file mode 100644 index 000000000000..43cd9dbf519b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclaves.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of VirtualEnclaves. + */ +public interface VirtualEnclaves { + /** + * Get a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String virtualEnclaveName, + Context context); + + /** + * Get a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveResource. + */ + EnclaveResource getByResourceGroup(String resourceGroupName, String virtualEnclaveName); + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String virtualEnclaveName); + + /** + * Delete a EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String virtualEnclaveName, Context context); + + /** + * List EnclaveResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List EnclaveResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List EnclaveResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List EnclaveResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a EnclaveResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body); + + /** + * Callback that triggers on approval state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalCreation(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body, Context context); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body); + + /** + * Callback that triggers on approval deletion state change. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + ApprovalActionResponse handleApprovalDeletion(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body, Context context); + + /** + * Get a EnclaveResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveResource along with {@link Response}. + */ + EnclaveResource getById(String id); + + /** + * Get a EnclaveResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a EnclaveResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a EnclaveResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a EnclaveResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new EnclaveResource resource. + * + * @param name resource name. + * @return the first stage of the new EnclaveResource definition. + */ + EnclaveResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadPatchModel.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadPatchModel.java new file mode 100644 index 000000000000..2d865d3f0b28 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadPatchModel.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Workload Patch Resource. + */ +@Fluent +public final class WorkloadPatchModel implements JsonSerializable { + /* + * Workload Patch properties + */ + private WorkloadPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of WorkloadPatchModel class. + */ + public WorkloadPatchModel() { + } + + /** + * Get the properties property: Workload Patch properties. + * + * @return the properties value. + */ + public WorkloadPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Workload Patch properties. + * + * @param properties the properties value to set. + * @return the WorkloadPatchModel object itself. + */ + public WorkloadPatchModel withProperties(WorkloadPatchProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the WorkloadPatchModel object itself. + */ + public WorkloadPatchModel withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadPatchModel from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadPatchModel if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the WorkloadPatchModel. + */ + public static WorkloadPatchModel fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadPatchModel deserializedWorkloadPatchModel = new WorkloadPatchModel(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedWorkloadPatchModel.properties = WorkloadPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedWorkloadPatchModel.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadPatchModel; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadPatchProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadPatchProperties.java new file mode 100644 index 000000000000..b9ad5965dadb --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadPatchProperties.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Workload patchable Properties. + */ +@Fluent +public final class WorkloadPatchProperties implements JsonSerializable { + /* + * List of resource group ids. + */ + private List resourceGroupCollection; + + /** + * Creates an instance of WorkloadPatchProperties class. + */ + public WorkloadPatchProperties() { + } + + /** + * Get the resourceGroupCollection property: List of resource group ids. + * + * @return the resourceGroupCollection value. + */ + public List resourceGroupCollection() { + return this.resourceGroupCollection; + } + + /** + * Set the resourceGroupCollection property: List of resource group ids. + * + * @param resourceGroupCollection the resourceGroupCollection value to set. + * @return the WorkloadPatchProperties object itself. + */ + public WorkloadPatchProperties withResourceGroupCollection(List resourceGroupCollection) { + this.resourceGroupCollection = resourceGroupCollection; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGroupCollection", this.resourceGroupCollection, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadPatchProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the WorkloadPatchProperties. + */ + public static WorkloadPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadPatchProperties deserializedWorkloadPatchProperties = new WorkloadPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceGroupCollection".equals(fieldName)) { + List resourceGroupCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedWorkloadPatchProperties.resourceGroupCollection = resourceGroupCollection; + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadPatchProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadProperties.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadProperties.java new file mode 100644 index 000000000000..1f83ebb0e583 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadProperties.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Workload Resource properties. + */ +@Fluent +public final class WorkloadProperties implements JsonSerializable { + /* + * Provisioning State. + */ + private ProvisioningState provisioningState; + + /* + * List of resource group ids. + */ + private List resourceGroupCollection; + + /* + * Managed On Behalf Of Configuration. + */ + private ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration; + + /** + * Creates an instance of WorkloadProperties class. + */ + public WorkloadProperties() { + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the resourceGroupCollection property: List of resource group ids. + * + * @return the resourceGroupCollection value. + */ + public List resourceGroupCollection() { + return this.resourceGroupCollection; + } + + /** + * Set the resourceGroupCollection property: List of resource group ids. + * + * @param resourceGroupCollection the resourceGroupCollection value to set. + * @return the WorkloadProperties object itself. + */ + public WorkloadProperties withResourceGroupCollection(List resourceGroupCollection) { + this.resourceGroupCollection = resourceGroupCollection; + return this; + } + + /** + * Get the managedOnBehalfOfConfiguration property: Managed On Behalf Of Configuration. + * + * @return the managedOnBehalfOfConfiguration value. + */ + public ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration() { + return this.managedOnBehalfOfConfiguration; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("resourceGroupCollection", this.resourceGroupCollection, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkloadProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the WorkloadProperties. + */ + public static WorkloadProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadProperties deserializedWorkloadProperties = new WorkloadProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedWorkloadProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("resourceGroupCollection".equals(fieldName)) { + List resourceGroupCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedWorkloadProperties.resourceGroupCollection = resourceGroupCollection; + } else if ("managedOnBehalfOfConfiguration".equals(fieldName)) { + deserializedWorkloadProperties.managedOnBehalfOfConfiguration + = ManagedOnBehalfOfConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadProperties; + }); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadResource.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadResource.java new file mode 100644 index 000000000000..f50f830d1bd5 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadResource.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.virtualenclaves.fluent.models.WorkloadResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of WorkloadResource. + */ +public interface WorkloadResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + WorkloadProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.virtualenclaves.fluent.models.WorkloadResourceInner object. + * + * @return the inner object. + */ + WorkloadResourceInner innerModel(); + + /** + * The entirety of the WorkloadResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The WorkloadResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the WorkloadResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the WorkloadResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the WorkloadResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, virtualEnclaveName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @return the next definition stage. + */ + WithCreate withExistingVirtualEnclave(String resourceGroupName, String virtualEnclaveName); + } + + /** + * The stage of the WorkloadResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkloadResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkloadResource create(Context context); + } + + /** + * The stage of the WorkloadResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the WorkloadResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(WorkloadProperties properties); + } + } + + /** + * Begins update for the WorkloadResource resource. + * + * @return the stage of resource update. + */ + WorkloadResource.Update update(); + + /** + * The template for WorkloadResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkloadResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkloadResource apply(Context context); + } + + /** + * The WorkloadResource update stages. + */ + interface UpdateStages { + /** + * The stage of the WorkloadResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the WorkloadResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Workload Patch properties. + * + * @param properties Workload Patch properties. + * @return the next definition stage. + */ + Update withProperties(WorkloadPatchProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkloadResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkloadResource refresh(Context context); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Workloads.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Workloads.java new file mode 100644 index 000000000000..299ce2374fce --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/Workloads.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Workloads. + */ +public interface Workloads { + /** + * Get a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadResource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String virtualEnclaveName, String workloadName, + Context context); + + /** + * Get a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadResource. + */ + WorkloadResource get(String resourceGroupName, String virtualEnclaveName, String workloadName); + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String virtualEnclaveName, String workloadName); + + /** + * Delete a WorkloadResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param workloadName The name of the workloadResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String virtualEnclaveName, String workloadName, Context context); + + /** + * List WorkloadResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByEnclaveResource(String resourceGroupName, String virtualEnclaveName); + + /** + * List WorkloadResource resources by EnclaveResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByEnclaveResource(String resourceGroupName, String virtualEnclaveName, + Context context); + + /** + * List WorkloadResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(String virtualEnclaveName); + + /** + * List WorkloadResource resources by subscription ID. + * + * @param virtualEnclaveName The name of the enclaveResource Resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkloadResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(String virtualEnclaveName, Context context); + + /** + * Get a WorkloadResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadResource along with {@link Response}. + */ + WorkloadResource getById(String id); + + /** + * Get a WorkloadResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a WorkloadResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a WorkloadResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a WorkloadResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkloadResource resource. + * + * @param name resource name. + * @return the first stage of the new WorkloadResource definition. + */ + WorkloadResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/package-info.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/package-info.java new file mode 100644 index 000000000000..f370d05e804d --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for VirtualEnclavesManagementClient. + * Microsoft Mission Resource Provider management API. + */ +package com.azure.resourcemanager.virtualenclaves.models; diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/package-info.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/package-info.java new file mode 100644 index 000000000000..399d7f4b706b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/com/azure/resourcemanager/virtualenclaves/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for VirtualEnclavesManagementClient. + * Microsoft Mission Resource Provider management API. + */ +package com.azure.resourcemanager.virtualenclaves; diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/module-info.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/module-info.java new file mode 100644 index 000000000000..adb7e9291045 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.virtualenclaves { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.virtualenclaves; + exports com.azure.resourcemanager.virtualenclaves.fluent; + exports com.azure.resourcemanager.virtualenclaves.fluent.models; + exports com.azure.resourcemanager.virtualenclaves.models; + + opens com.azure.resourcemanager.virtualenclaves.fluent.models to com.azure.core; + opens com.azure.resourcemanager.virtualenclaves.models to com.azure.core; + opens com.azure.resourcemanager.virtualenclaves.implementation.models to com.azure.core; +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/azure-resourcemanager-virtualenclaves_apiview_properties.json b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/azure-resourcemanager-virtualenclaves_apiview_properties.json new file mode 100644 index 000000000000..6825097acc3e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/azure-resourcemanager-virtualenclaves_apiview_properties.json @@ -0,0 +1,216 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient": "Microsoft.Mission.Approval", + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.beginCreateOrUpdate": "Microsoft.Mission.Approval.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.beginDelete": "Microsoft.Mission.Approval.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.beginNotifyInitiator": "Microsoft.Mission.Approval.notifyInitiator", + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.beginUpdate": "Microsoft.Mission.Approval.update", + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.createOrUpdate": "Microsoft.Mission.Approval.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.delete": "Microsoft.Mission.Approval.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.get": "Microsoft.Mission.Approval.get", + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.getWithResponse": "Microsoft.Mission.Approval.get", + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.listByParent": "Microsoft.Mission.Approval.listByParent", + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.notifyInitiator": "Microsoft.Mission.Approval.notifyInitiator", + "com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.update": "Microsoft.Mission.Approval.update", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient": "Microsoft.Mission.Community", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.beginCreateOrUpdate": "Microsoft.Mission.Community.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.beginDelete": "Microsoft.Mission.Community.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.beginUpdate": "Microsoft.Mission.Community.update", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.checkAddressSpaceAvailability": "Microsoft.Mission.Community.checkAddressSpaceAvailability", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.checkAddressSpaceAvailabilityWithResponse": "Microsoft.Mission.Community.checkAddressSpaceAvailability", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.createOrUpdate": "Microsoft.Mission.Community.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.delete": "Microsoft.Mission.Community.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.getByResourceGroup": "Microsoft.Mission.Community.get", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.getByResourceGroupWithResponse": "Microsoft.Mission.Community.get", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.list": "Microsoft.Mission.Community.listBySubscription", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.listByResourceGroup": "Microsoft.Mission.Community.listByResourceGroup", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.update": "Microsoft.Mission.Community.update", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient": "Microsoft.Mission.CommunityEndpoints", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.beginCreateOrUpdate": "Microsoft.Mission.CommunityEndpoints.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.beginDelete": "Microsoft.Mission.CommunityEndpoints.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.beginHandleApprovalCreation": "Microsoft.Mission.CommunityEndpoints.handleApprovalCreation", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.beginHandleApprovalDeletion": "Microsoft.Mission.CommunityEndpoints.handleApprovalDeletion", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.beginUpdate": "Microsoft.Mission.CommunityEndpoints.update", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.createOrUpdate": "Microsoft.Mission.CommunityEndpoints.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.delete": "Microsoft.Mission.CommunityEndpoints.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.get": "Microsoft.Mission.CommunityEndpoints.get", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.getWithResponse": "Microsoft.Mission.CommunityEndpoints.get", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.handleApprovalCreation": "Microsoft.Mission.CommunityEndpoints.handleApprovalCreation", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.handleApprovalDeletion": "Microsoft.Mission.CommunityEndpoints.handleApprovalDeletion", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.listByCommunityResource": "Microsoft.Mission.CommunityEndpoints.listByCommunityResource", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.listBySubscription": "Microsoft.Mission.CommunityEndpoints.listBySubscription", + "com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.update": "Microsoft.Mission.CommunityEndpoints.update", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient": "Microsoft.Mission.EnclaveConnection", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.beginCreateOrUpdate": "Microsoft.Mission.EnclaveConnection.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.beginDelete": "Microsoft.Mission.EnclaveConnection.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.beginHandleApprovalCreation": "Microsoft.Mission.EnclaveConnection.handleApprovalCreation", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.beginHandleApprovalDeletion": "Microsoft.Mission.EnclaveConnection.handleApprovalDeletion", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.beginUpdate": "Microsoft.Mission.EnclaveConnection.update", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.createOrUpdate": "Microsoft.Mission.EnclaveConnection.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.delete": "Microsoft.Mission.EnclaveConnection.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.getByResourceGroup": "Microsoft.Mission.EnclaveConnection.get", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.getByResourceGroupWithResponse": "Microsoft.Mission.EnclaveConnection.get", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.handleApprovalCreation": "Microsoft.Mission.EnclaveConnection.handleApprovalCreation", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.handleApprovalDeletion": "Microsoft.Mission.EnclaveConnection.handleApprovalDeletion", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.list": "Microsoft.Mission.EnclaveConnection.listBySubscription", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.listByResourceGroup": "Microsoft.Mission.EnclaveConnection.listByResourceGroup", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.update": "Microsoft.Mission.EnclaveConnection.update", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient": "Microsoft.Mission.EnclaveEndpoints", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.beginCreateOrUpdate": "Microsoft.Mission.EnclaveEndpoints.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.beginDelete": "Microsoft.Mission.EnclaveEndpoints.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.beginHandleApprovalCreation": "Microsoft.Mission.EnclaveEndpoints.handleApprovalCreation", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.beginHandleApprovalDeletion": "Microsoft.Mission.EnclaveEndpoints.handleApprovalDeletion", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.beginUpdate": "Microsoft.Mission.EnclaveEndpoints.update", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.createOrUpdate": "Microsoft.Mission.EnclaveEndpoints.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.delete": "Microsoft.Mission.EnclaveEndpoints.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.get": "Microsoft.Mission.EnclaveEndpoints.get", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.getWithResponse": "Microsoft.Mission.EnclaveEndpoints.get", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.handleApprovalCreation": "Microsoft.Mission.EnclaveEndpoints.handleApprovalCreation", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.handleApprovalDeletion": "Microsoft.Mission.EnclaveEndpoints.handleApprovalDeletion", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.listByEnclaveResource": "Microsoft.Mission.EnclaveEndpoints.listByEnclaveResource", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.listBySubscription": "Microsoft.Mission.EnclaveEndpoints.listBySubscription", + "com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.update": "Microsoft.Mission.EnclaveEndpoints.update", + "com.azure.resourcemanager.virtualenclaves.fluent.OperationsClient": "Microsoft.Mission.Operations", + "com.azure.resourcemanager.virtualenclaves.fluent.OperationsClient.list": "Azure.ResourceManager.Operations.list", + "com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient": "Microsoft.Mission.TransitHub", + "com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.beginCreateOrUpdate": "Microsoft.Mission.TransitHub.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.beginDelete": "Microsoft.Mission.TransitHub.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.beginUpdate": "Microsoft.Mission.TransitHub.update", + "com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.createOrUpdate": "Microsoft.Mission.TransitHub.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.delete": "Microsoft.Mission.TransitHub.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.get": "Microsoft.Mission.TransitHub.get", + "com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.getWithResponse": "Microsoft.Mission.TransitHub.get", + "com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.listByCommunityResource": "Microsoft.Mission.TransitHub.listByCommunityResource", + "com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.listBySubscription": "Microsoft.Mission.TransitHub.listBySubscription", + "com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.update": "Microsoft.Mission.TransitHub.update", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient": "Microsoft.Mission.VirtualEnclave", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.beginCreateOrUpdate": "Microsoft.Mission.VirtualEnclave.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.beginDelete": "Microsoft.Mission.VirtualEnclave.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.beginHandleApprovalCreation": "Microsoft.Mission.VirtualEnclave.handleApprovalCreation", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.beginHandleApprovalDeletion": "Microsoft.Mission.VirtualEnclave.handleApprovalDeletion", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.beginUpdate": "Microsoft.Mission.VirtualEnclave.update", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.createOrUpdate": "Microsoft.Mission.VirtualEnclave.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.delete": "Microsoft.Mission.VirtualEnclave.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.getByResourceGroup": "Microsoft.Mission.VirtualEnclave.get", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.getByResourceGroupWithResponse": "Microsoft.Mission.VirtualEnclave.get", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.handleApprovalCreation": "Microsoft.Mission.VirtualEnclave.handleApprovalCreation", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.handleApprovalDeletion": "Microsoft.Mission.VirtualEnclave.handleApprovalDeletion", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.list": "Microsoft.Mission.VirtualEnclave.listBySubscription", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.listByResourceGroup": "Microsoft.Mission.VirtualEnclave.listByResourceGroup", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.update": "Microsoft.Mission.VirtualEnclave.update", + "com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesManagementClient": "Microsoft.Mission", + "com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient": "Microsoft.Mission.Workload", + "com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.beginCreateOrUpdate": "Microsoft.Mission.Workload.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.beginDelete": "Microsoft.Mission.Workload.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.beginUpdate": "Microsoft.Mission.Workload.update", + "com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.createOrUpdate": "Microsoft.Mission.Workload.createOrUpdate", + "com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.delete": "Microsoft.Mission.Workload.delete", + "com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.get": "Microsoft.Mission.Workload.get", + "com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.getWithResponse": "Microsoft.Mission.Workload.get", + "com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.listByEnclaveResource": "Microsoft.Mission.Workload.listByEnclaveResource", + "com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.listBySubscription": "Microsoft.Mission.Workload.listBySubscription", + "com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.update": "Microsoft.Mission.Workload.update", + "com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner": "Microsoft.Mission.ApprovalActionResponse", + "com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalResourceInner": "Microsoft.Mission.ApprovalResource", + "com.azure.resourcemanager.virtualenclaves.fluent.models.CheckAddressSpaceAvailabilityResponseInner": "Microsoft.Mission.CheckAddressSpaceAvailabilityResponse", + "com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityEndpointResourceInner": "Microsoft.Mission.CommunityEndpointResource", + "com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityResourceInner": "Microsoft.Mission.CommunityResource", + "com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveConnectionResourceInner": "Microsoft.Mission.EnclaveConnectionResource", + "com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveEndpointResourceInner": "Microsoft.Mission.EnclaveEndpointResource", + "com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveResourceInner": "Microsoft.Mission.EnclaveResource", + "com.azure.resourcemanager.virtualenclaves.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", + "com.azure.resourcemanager.virtualenclaves.fluent.models.TransitHubResourceInner": "Microsoft.Mission.TransitHubResource", + "com.azure.resourcemanager.virtualenclaves.fluent.models.WorkloadResourceInner": "Microsoft.Mission.WorkloadResource", + "com.azure.resourcemanager.virtualenclaves.implementation.VirtualEnclavesManagementClientBuilder": "Microsoft.Mission", + "com.azure.resourcemanager.virtualenclaves.implementation.models.ApprovalResourceListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.virtualenclaves.implementation.models.CommunityEndpointResourceListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.virtualenclaves.implementation.models.CommunityResourceListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.virtualenclaves.implementation.models.EnclaveConnectionResourceListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.virtualenclaves.implementation.models.EnclaveEndpointResourceListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.virtualenclaves.implementation.models.EnclaveResourceListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.virtualenclaves.implementation.models.OperationListResult": "Azure.ResourceManager.CommonTypes.OperationListResult", + "com.azure.resourcemanager.virtualenclaves.implementation.models.TransitHubResourceListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.virtualenclaves.implementation.models.WorkloadResourceListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.virtualenclaves.models.ActionPerformed": "Microsoft.Mission.ActionPerformed", + "com.azure.resourcemanager.virtualenclaves.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequest": "Microsoft.Mission.ApprovalActionRequest", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequestApprovalStatus": "Microsoft.Mission.ApprovalActionRequest.approvalStatus.anonymous", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest": "Microsoft.Mission.ApprovalCallbackRequest", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus": "Microsoft.Mission.ApprovalCallbackRequest.approvalStatus.anonymous", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction": "Microsoft.Mission.ApprovalCallbackRequest.resourceRequestAction.anonymous", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest": "Microsoft.Mission.ApprovalDeletionCallbackRequest", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction": "Microsoft.Mission.ApprovalDeletionCallbackRequest.resourceRequestAction.anonymous", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchModel": "Microsoft.Mission.ApprovalPatchModel", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchProperties": "Microsoft.Mission.ApprovalPatchProperties", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy": "Microsoft.Mission.ApprovalPolicy", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalProperties": "Microsoft.Mission.ApprovalProperties", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalSettings": "Microsoft.Mission.ApprovalSettings", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalSettingsPatchProperties": "Microsoft.Mission.ApprovalSettingsPatchProperties", + "com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus": "Microsoft.Mission.ApprovalStatus", + "com.azure.resourcemanager.virtualenclaves.models.Approver": "Microsoft.Mission.Approver", + "com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityRequest": "Microsoft.Mission.CheckAddressSpaceAvailabilityRequest", + "com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule": "Microsoft.Mission.CommunityEndpointDestinationRule", + "com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchModel": "Microsoft.Mission.CommunityEndpointPatchModel", + "com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchProperties": "Microsoft.Mission.CommunityEndpointPatchProperties", + "com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProperties": "Microsoft.Mission.CommunityEndpointProperties", + "com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol": "Microsoft.Mission.CommunityEndpointProtocol", + "com.azure.resourcemanager.virtualenclaves.models.CommunityPatchModel": "Microsoft.Mission.CommunityPatchModel", + "com.azure.resourcemanager.virtualenclaves.models.CommunityPatchProperties": "Microsoft.Mission.CommunityPatchProperties", + "com.azure.resourcemanager.virtualenclaves.models.CommunityProperties": "Microsoft.Mission.CommunityProperties", + "com.azure.resourcemanager.virtualenclaves.models.CommunityPropertiesPolicyOverride": "Microsoft.Mission.CommunityProperties.policyOverride.anonymous", + "com.azure.resourcemanager.virtualenclaves.models.DestinationType": "Microsoft.Mission.DestinationType", + "com.azure.resourcemanager.virtualenclaves.models.DiagnosticDestination": "Microsoft.Mission.DiagnosticDestination", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveAddressSpacesModel": "Microsoft.Mission.EnclaveAddressSpacesModel", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchModel": "Microsoft.Mission.EnclaveConnectionPatchModel", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchProperties": "Microsoft.Mission.EnclaveConnectionPatchProperties", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionProperties": "Microsoft.Mission.EnclaveConnectionProperties", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionState": "Microsoft.Mission.EnclaveConnectionState", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveDefaultSettingsModel": "Microsoft.Mission.EnclaveDefaultSettingsModel", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveDefaultSettingsPatchModel": "Microsoft.Mission.EnclaveDefaultSettingsPatchModel", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule": "Microsoft.Mission.EnclaveEndpointDestinationRule", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchModel": "Microsoft.Mission.EnclaveEndpointPatchModel", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchProperties": "Microsoft.Mission.EnclaveEndpointPatchProperties", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProperties": "Microsoft.Mission.EnclaveEndpointProperties", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol": "Microsoft.Mission.EnclaveEndpointProtocol", + "com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel": "Microsoft.Mission.EnclaveVirtualNetworkModel", + "com.azure.resourcemanager.virtualenclaves.models.FirewallSKU": "Microsoft.Mission.FirewallSKU", + "com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem": "Microsoft.Mission.GovernedServiceItem", + "com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement": "Microsoft.Mission.GovernedServiceItem.enforcement.anonymous", + "com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption": "Microsoft.Mission.GovernedServiceItem.option.anonymous", + "com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction": "Microsoft.Mission.GovernedServiceItem.policyAction.anonymous", + "com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModel": "Microsoft.Mission.MaintenanceModeConfigurationModel", + "com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification": "Microsoft.Mission.MaintenanceModeConfigurationModel.justification.anonymous", + "com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode": "Microsoft.Mission.MaintenanceModeConfigurationModel.mode.anonymous", + "com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationPatchModel": "Microsoft.Mission.MaintenanceModeConfigurationPatchModel", + "com.azure.resourcemanager.virtualenclaves.models.ManagedOnBehalfOfConfiguration": "Azure.ResourceManager.CommonTypes.ManagedOnBehalfOfConfiguration", + "com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover": "Microsoft.Mission.MandatoryApprover", + "com.azure.resourcemanager.virtualenclaves.models.MoboBrokerResource": "Azure.ResourceManager.CommonTypes.MoboBrokerResource", + "com.azure.resourcemanager.virtualenclaves.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "com.azure.resourcemanager.virtualenclaves.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "com.azure.resourcemanager.virtualenclaves.models.Principal": "Microsoft.Mission.Principal", + "com.azure.resourcemanager.virtualenclaves.models.PrincipalType": "Microsoft.Mission.Principal.type.anonymous", + "com.azure.resourcemanager.virtualenclaves.models.ProvisioningState": "Microsoft.Mission.ProvisioningState", + "com.azure.resourcemanager.virtualenclaves.models.RequestMetadata": "Microsoft.Mission.RequestMetadata", + "com.azure.resourcemanager.virtualenclaves.models.RequestMetadataUpdatableProperties": "Microsoft.Mission.RequestMetadataUpdatableProperties", + "com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem": "Microsoft.Mission.RoleAssignmentItem", + "com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier": "Microsoft.Mission.ServiceIdentifier", + "com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration": "Microsoft.Mission.SubnetConfiguration", + "com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchModel": "Microsoft.Mission.TransitHubPatchModel", + "com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchProperties": "Microsoft.Mission.TransitHubPatchProperties", + "com.azure.resourcemanager.virtualenclaves.models.TransitHubProperties": "Microsoft.Mission.TransitHubProperties", + "com.azure.resourcemanager.virtualenclaves.models.TransitHubState": "Microsoft.Mission.TransitHubState", + "com.azure.resourcemanager.virtualenclaves.models.TransitOption": "Microsoft.Mission.TransitOption", + "com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams": "Microsoft.Mission.TransitOptionParams", + "com.azure.resourcemanager.virtualenclaves.models.TransitOptionType": "Microsoft.Mission.TransitOptionType", + "com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchModel": "Microsoft.Mission.VirtualEnclavePatchModel", + "com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchProperties": "Microsoft.Mission.VirtualEnclavePatchProperties", + "com.azure.resourcemanager.virtualenclaves.models.VirtualEnclaveProperties": "Microsoft.Mission.VirtualEnclaveProperties", + "com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchModel": "Microsoft.Mission.WorkloadPatchModel", + "com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchProperties": "Microsoft.Mission.WorkloadPatchProperties", + "com.azure.resourcemanager.virtualenclaves.models.WorkloadProperties": "Microsoft.Mission.WorkloadProperties" + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/azure-resourcemanager-virtualenclaves_metadata.json b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/azure-resourcemanager-virtualenclaves_metadata.json new file mode 100644 index 000000000000..d889f75c113f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/azure-resourcemanager-virtualenclaves_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersion":"2025-05-01-preview","crossLanguageDefinitions":{"com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient":"Microsoft.Mission.Approval","com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.beginCreateOrUpdate":"Microsoft.Mission.Approval.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.beginDelete":"Microsoft.Mission.Approval.delete","com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.beginNotifyInitiator":"Microsoft.Mission.Approval.notifyInitiator","com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.beginUpdate":"Microsoft.Mission.Approval.update","com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.createOrUpdate":"Microsoft.Mission.Approval.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.delete":"Microsoft.Mission.Approval.delete","com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.get":"Microsoft.Mission.Approval.get","com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.getWithResponse":"Microsoft.Mission.Approval.get","com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.listByParent":"Microsoft.Mission.Approval.listByParent","com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.notifyInitiator":"Microsoft.Mission.Approval.notifyInitiator","com.azure.resourcemanager.virtualenclaves.fluent.ApprovalsClient.update":"Microsoft.Mission.Approval.update","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient":"Microsoft.Mission.Community","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.beginCreateOrUpdate":"Microsoft.Mission.Community.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.beginDelete":"Microsoft.Mission.Community.delete","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.beginUpdate":"Microsoft.Mission.Community.update","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.checkAddressSpaceAvailability":"Microsoft.Mission.Community.checkAddressSpaceAvailability","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.checkAddressSpaceAvailabilityWithResponse":"Microsoft.Mission.Community.checkAddressSpaceAvailability","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.createOrUpdate":"Microsoft.Mission.Community.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.delete":"Microsoft.Mission.Community.delete","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.getByResourceGroup":"Microsoft.Mission.Community.get","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.getByResourceGroupWithResponse":"Microsoft.Mission.Community.get","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.list":"Microsoft.Mission.Community.listBySubscription","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.listByResourceGroup":"Microsoft.Mission.Community.listByResourceGroup","com.azure.resourcemanager.virtualenclaves.fluent.CommunitiesClient.update":"Microsoft.Mission.Community.update","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient":"Microsoft.Mission.CommunityEndpoints","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.beginCreateOrUpdate":"Microsoft.Mission.CommunityEndpoints.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.beginDelete":"Microsoft.Mission.CommunityEndpoints.delete","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.beginHandleApprovalCreation":"Microsoft.Mission.CommunityEndpoints.handleApprovalCreation","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.beginHandleApprovalDeletion":"Microsoft.Mission.CommunityEndpoints.handleApprovalDeletion","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.beginUpdate":"Microsoft.Mission.CommunityEndpoints.update","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.createOrUpdate":"Microsoft.Mission.CommunityEndpoints.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.delete":"Microsoft.Mission.CommunityEndpoints.delete","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.get":"Microsoft.Mission.CommunityEndpoints.get","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.getWithResponse":"Microsoft.Mission.CommunityEndpoints.get","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.handleApprovalCreation":"Microsoft.Mission.CommunityEndpoints.handleApprovalCreation","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.handleApprovalDeletion":"Microsoft.Mission.CommunityEndpoints.handleApprovalDeletion","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.listByCommunityResource":"Microsoft.Mission.CommunityEndpoints.listByCommunityResource","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.listBySubscription":"Microsoft.Mission.CommunityEndpoints.listBySubscription","com.azure.resourcemanager.virtualenclaves.fluent.CommunityEndpointsClient.update":"Microsoft.Mission.CommunityEndpoints.update","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient":"Microsoft.Mission.EnclaveConnection","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.beginCreateOrUpdate":"Microsoft.Mission.EnclaveConnection.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.beginDelete":"Microsoft.Mission.EnclaveConnection.delete","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.beginHandleApprovalCreation":"Microsoft.Mission.EnclaveConnection.handleApprovalCreation","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.beginHandleApprovalDeletion":"Microsoft.Mission.EnclaveConnection.handleApprovalDeletion","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.beginUpdate":"Microsoft.Mission.EnclaveConnection.update","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.createOrUpdate":"Microsoft.Mission.EnclaveConnection.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.delete":"Microsoft.Mission.EnclaveConnection.delete","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.getByResourceGroup":"Microsoft.Mission.EnclaveConnection.get","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.getByResourceGroupWithResponse":"Microsoft.Mission.EnclaveConnection.get","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.handleApprovalCreation":"Microsoft.Mission.EnclaveConnection.handleApprovalCreation","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.handleApprovalDeletion":"Microsoft.Mission.EnclaveConnection.handleApprovalDeletion","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.list":"Microsoft.Mission.EnclaveConnection.listBySubscription","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.listByResourceGroup":"Microsoft.Mission.EnclaveConnection.listByResourceGroup","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveConnectionsClient.update":"Microsoft.Mission.EnclaveConnection.update","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient":"Microsoft.Mission.EnclaveEndpoints","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.beginCreateOrUpdate":"Microsoft.Mission.EnclaveEndpoints.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.beginDelete":"Microsoft.Mission.EnclaveEndpoints.delete","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.beginHandleApprovalCreation":"Microsoft.Mission.EnclaveEndpoints.handleApprovalCreation","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.beginHandleApprovalDeletion":"Microsoft.Mission.EnclaveEndpoints.handleApprovalDeletion","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.beginUpdate":"Microsoft.Mission.EnclaveEndpoints.update","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.createOrUpdate":"Microsoft.Mission.EnclaveEndpoints.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.delete":"Microsoft.Mission.EnclaveEndpoints.delete","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.get":"Microsoft.Mission.EnclaveEndpoints.get","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.getWithResponse":"Microsoft.Mission.EnclaveEndpoints.get","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.handleApprovalCreation":"Microsoft.Mission.EnclaveEndpoints.handleApprovalCreation","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.handleApprovalDeletion":"Microsoft.Mission.EnclaveEndpoints.handleApprovalDeletion","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.listByEnclaveResource":"Microsoft.Mission.EnclaveEndpoints.listByEnclaveResource","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.listBySubscription":"Microsoft.Mission.EnclaveEndpoints.listBySubscription","com.azure.resourcemanager.virtualenclaves.fluent.EnclaveEndpointsClient.update":"Microsoft.Mission.EnclaveEndpoints.update","com.azure.resourcemanager.virtualenclaves.fluent.OperationsClient":"Microsoft.Mission.Operations","com.azure.resourcemanager.virtualenclaves.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient":"Microsoft.Mission.TransitHub","com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.beginCreateOrUpdate":"Microsoft.Mission.TransitHub.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.beginDelete":"Microsoft.Mission.TransitHub.delete","com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.beginUpdate":"Microsoft.Mission.TransitHub.update","com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.createOrUpdate":"Microsoft.Mission.TransitHub.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.delete":"Microsoft.Mission.TransitHub.delete","com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.get":"Microsoft.Mission.TransitHub.get","com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.getWithResponse":"Microsoft.Mission.TransitHub.get","com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.listByCommunityResource":"Microsoft.Mission.TransitHub.listByCommunityResource","com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.listBySubscription":"Microsoft.Mission.TransitHub.listBySubscription","com.azure.resourcemanager.virtualenclaves.fluent.TransitHubsClient.update":"Microsoft.Mission.TransitHub.update","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient":"Microsoft.Mission.VirtualEnclave","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.beginCreateOrUpdate":"Microsoft.Mission.VirtualEnclave.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.beginDelete":"Microsoft.Mission.VirtualEnclave.delete","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.beginHandleApprovalCreation":"Microsoft.Mission.VirtualEnclave.handleApprovalCreation","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.beginHandleApprovalDeletion":"Microsoft.Mission.VirtualEnclave.handleApprovalDeletion","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.beginUpdate":"Microsoft.Mission.VirtualEnclave.update","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.createOrUpdate":"Microsoft.Mission.VirtualEnclave.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.delete":"Microsoft.Mission.VirtualEnclave.delete","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.getByResourceGroup":"Microsoft.Mission.VirtualEnclave.get","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.getByResourceGroupWithResponse":"Microsoft.Mission.VirtualEnclave.get","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.handleApprovalCreation":"Microsoft.Mission.VirtualEnclave.handleApprovalCreation","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.handleApprovalDeletion":"Microsoft.Mission.VirtualEnclave.handleApprovalDeletion","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.list":"Microsoft.Mission.VirtualEnclave.listBySubscription","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.listByResourceGroup":"Microsoft.Mission.VirtualEnclave.listByResourceGroup","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesClient.update":"Microsoft.Mission.VirtualEnclave.update","com.azure.resourcemanager.virtualenclaves.fluent.VirtualEnclavesManagementClient":"Microsoft.Mission","com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient":"Microsoft.Mission.Workload","com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.beginCreateOrUpdate":"Microsoft.Mission.Workload.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.beginDelete":"Microsoft.Mission.Workload.delete","com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.beginUpdate":"Microsoft.Mission.Workload.update","com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.createOrUpdate":"Microsoft.Mission.Workload.createOrUpdate","com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.delete":"Microsoft.Mission.Workload.delete","com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.get":"Microsoft.Mission.Workload.get","com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.getWithResponse":"Microsoft.Mission.Workload.get","com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.listByEnclaveResource":"Microsoft.Mission.Workload.listByEnclaveResource","com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.listBySubscription":"Microsoft.Mission.Workload.listBySubscription","com.azure.resourcemanager.virtualenclaves.fluent.WorkloadsClient.update":"Microsoft.Mission.Workload.update","com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner":"Microsoft.Mission.ApprovalActionResponse","com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalResourceInner":"Microsoft.Mission.ApprovalResource","com.azure.resourcemanager.virtualenclaves.fluent.models.CheckAddressSpaceAvailabilityResponseInner":"Microsoft.Mission.CheckAddressSpaceAvailabilityResponse","com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityEndpointResourceInner":"Microsoft.Mission.CommunityEndpointResource","com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityResourceInner":"Microsoft.Mission.CommunityResource","com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveConnectionResourceInner":"Microsoft.Mission.EnclaveConnectionResource","com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveEndpointResourceInner":"Microsoft.Mission.EnclaveEndpointResource","com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveResourceInner":"Microsoft.Mission.EnclaveResource","com.azure.resourcemanager.virtualenclaves.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.virtualenclaves.fluent.models.TransitHubResourceInner":"Microsoft.Mission.TransitHubResource","com.azure.resourcemanager.virtualenclaves.fluent.models.WorkloadResourceInner":"Microsoft.Mission.WorkloadResource","com.azure.resourcemanager.virtualenclaves.implementation.VirtualEnclavesManagementClientBuilder":"Microsoft.Mission","com.azure.resourcemanager.virtualenclaves.implementation.models.ApprovalResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.virtualenclaves.implementation.models.CommunityEndpointResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.virtualenclaves.implementation.models.CommunityResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.virtualenclaves.implementation.models.EnclaveConnectionResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.virtualenclaves.implementation.models.EnclaveEndpointResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.virtualenclaves.implementation.models.EnclaveResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.virtualenclaves.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.virtualenclaves.implementation.models.TransitHubResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.virtualenclaves.implementation.models.WorkloadResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.virtualenclaves.models.ActionPerformed":"Microsoft.Mission.ActionPerformed","com.azure.resourcemanager.virtualenclaves.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequest":"Microsoft.Mission.ApprovalActionRequest","com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequestApprovalStatus":"Microsoft.Mission.ApprovalActionRequest.approvalStatus.anonymous","com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest":"Microsoft.Mission.ApprovalCallbackRequest","com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus":"Microsoft.Mission.ApprovalCallbackRequest.approvalStatus.anonymous","com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction":"Microsoft.Mission.ApprovalCallbackRequest.resourceRequestAction.anonymous","com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest":"Microsoft.Mission.ApprovalDeletionCallbackRequest","com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction":"Microsoft.Mission.ApprovalDeletionCallbackRequest.resourceRequestAction.anonymous","com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchModel":"Microsoft.Mission.ApprovalPatchModel","com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchProperties":"Microsoft.Mission.ApprovalPatchProperties","com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy":"Microsoft.Mission.ApprovalPolicy","com.azure.resourcemanager.virtualenclaves.models.ApprovalProperties":"Microsoft.Mission.ApprovalProperties","com.azure.resourcemanager.virtualenclaves.models.ApprovalSettings":"Microsoft.Mission.ApprovalSettings","com.azure.resourcemanager.virtualenclaves.models.ApprovalSettingsPatchProperties":"Microsoft.Mission.ApprovalSettingsPatchProperties","com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus":"Microsoft.Mission.ApprovalStatus","com.azure.resourcemanager.virtualenclaves.models.Approver":"Microsoft.Mission.Approver","com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityRequest":"Microsoft.Mission.CheckAddressSpaceAvailabilityRequest","com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule":"Microsoft.Mission.CommunityEndpointDestinationRule","com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchModel":"Microsoft.Mission.CommunityEndpointPatchModel","com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchProperties":"Microsoft.Mission.CommunityEndpointPatchProperties","com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProperties":"Microsoft.Mission.CommunityEndpointProperties","com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol":"Microsoft.Mission.CommunityEndpointProtocol","com.azure.resourcemanager.virtualenclaves.models.CommunityPatchModel":"Microsoft.Mission.CommunityPatchModel","com.azure.resourcemanager.virtualenclaves.models.CommunityPatchProperties":"Microsoft.Mission.CommunityPatchProperties","com.azure.resourcemanager.virtualenclaves.models.CommunityProperties":"Microsoft.Mission.CommunityProperties","com.azure.resourcemanager.virtualenclaves.models.CommunityPropertiesPolicyOverride":"Microsoft.Mission.CommunityProperties.policyOverride.anonymous","com.azure.resourcemanager.virtualenclaves.models.DestinationType":"Microsoft.Mission.DestinationType","com.azure.resourcemanager.virtualenclaves.models.DiagnosticDestination":"Microsoft.Mission.DiagnosticDestination","com.azure.resourcemanager.virtualenclaves.models.EnclaveAddressSpacesModel":"Microsoft.Mission.EnclaveAddressSpacesModel","com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchModel":"Microsoft.Mission.EnclaveConnectionPatchModel","com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchProperties":"Microsoft.Mission.EnclaveConnectionPatchProperties","com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionProperties":"Microsoft.Mission.EnclaveConnectionProperties","com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionState":"Microsoft.Mission.EnclaveConnectionState","com.azure.resourcemanager.virtualenclaves.models.EnclaveDefaultSettingsModel":"Microsoft.Mission.EnclaveDefaultSettingsModel","com.azure.resourcemanager.virtualenclaves.models.EnclaveDefaultSettingsPatchModel":"Microsoft.Mission.EnclaveDefaultSettingsPatchModel","com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule":"Microsoft.Mission.EnclaveEndpointDestinationRule","com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchModel":"Microsoft.Mission.EnclaveEndpointPatchModel","com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchProperties":"Microsoft.Mission.EnclaveEndpointPatchProperties","com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProperties":"Microsoft.Mission.EnclaveEndpointProperties","com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol":"Microsoft.Mission.EnclaveEndpointProtocol","com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel":"Microsoft.Mission.EnclaveVirtualNetworkModel","com.azure.resourcemanager.virtualenclaves.models.FirewallSKU":"Microsoft.Mission.FirewallSKU","com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem":"Microsoft.Mission.GovernedServiceItem","com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement":"Microsoft.Mission.GovernedServiceItem.enforcement.anonymous","com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption":"Microsoft.Mission.GovernedServiceItem.option.anonymous","com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction":"Microsoft.Mission.GovernedServiceItem.policyAction.anonymous","com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModel":"Microsoft.Mission.MaintenanceModeConfigurationModel","com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification":"Microsoft.Mission.MaintenanceModeConfigurationModel.justification.anonymous","com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode":"Microsoft.Mission.MaintenanceModeConfigurationModel.mode.anonymous","com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationPatchModel":"Microsoft.Mission.MaintenanceModeConfigurationPatchModel","com.azure.resourcemanager.virtualenclaves.models.ManagedOnBehalfOfConfiguration":"Azure.ResourceManager.CommonTypes.ManagedOnBehalfOfConfiguration","com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover":"Microsoft.Mission.MandatoryApprover","com.azure.resourcemanager.virtualenclaves.models.MoboBrokerResource":"Azure.ResourceManager.CommonTypes.MoboBrokerResource","com.azure.resourcemanager.virtualenclaves.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.virtualenclaves.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.virtualenclaves.models.Principal":"Microsoft.Mission.Principal","com.azure.resourcemanager.virtualenclaves.models.PrincipalType":"Microsoft.Mission.Principal.type.anonymous","com.azure.resourcemanager.virtualenclaves.models.ProvisioningState":"Microsoft.Mission.ProvisioningState","com.azure.resourcemanager.virtualenclaves.models.RequestMetadata":"Microsoft.Mission.RequestMetadata","com.azure.resourcemanager.virtualenclaves.models.RequestMetadataUpdatableProperties":"Microsoft.Mission.RequestMetadataUpdatableProperties","com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem":"Microsoft.Mission.RoleAssignmentItem","com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier":"Microsoft.Mission.ServiceIdentifier","com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration":"Microsoft.Mission.SubnetConfiguration","com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchModel":"Microsoft.Mission.TransitHubPatchModel","com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchProperties":"Microsoft.Mission.TransitHubPatchProperties","com.azure.resourcemanager.virtualenclaves.models.TransitHubProperties":"Microsoft.Mission.TransitHubProperties","com.azure.resourcemanager.virtualenclaves.models.TransitHubState":"Microsoft.Mission.TransitHubState","com.azure.resourcemanager.virtualenclaves.models.TransitOption":"Microsoft.Mission.TransitOption","com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams":"Microsoft.Mission.TransitOptionParams","com.azure.resourcemanager.virtualenclaves.models.TransitOptionType":"Microsoft.Mission.TransitOptionType","com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity","com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchModel":"Microsoft.Mission.VirtualEnclavePatchModel","com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchProperties":"Microsoft.Mission.VirtualEnclavePatchProperties","com.azure.resourcemanager.virtualenclaves.models.VirtualEnclaveProperties":"Microsoft.Mission.VirtualEnclaveProperties","com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchModel":"Microsoft.Mission.WorkloadPatchModel","com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchProperties":"Microsoft.Mission.WorkloadPatchProperties","com.azure.resourcemanager.virtualenclaves.models.WorkloadProperties":"Microsoft.Mission.WorkloadProperties"},"generatedFiles":["src/main/java/com/azure/resourcemanager/virtualenclaves/VirtualEnclavesManager.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/ApprovalsClient.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/CommunitiesClient.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/CommunityEndpointsClient.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/EnclaveConnectionsClient.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/EnclaveEndpointsClient.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/TransitHubsClient.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/VirtualEnclavesClient.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/VirtualEnclavesManagementClient.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/WorkloadsClient.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/ApprovalActionResponseInner.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/ApprovalResourceInner.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CheckAddressSpaceAvailabilityResponseInner.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CommunityEndpointResourceInner.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/CommunityResourceInner.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveConnectionResourceInner.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveEndpointResourceInner.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/EnclaveResourceInner.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/TransitHubResourceInner.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/WorkloadResourceInner.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/virtualenclaves/fluent/package-info.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalActionResponseImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalResourceImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalsClientImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ApprovalsImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CheckAddressSpaceAvailabilityResponseImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunitiesClientImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunitiesImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointResourceImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointsClientImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityEndpointsImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/CommunityResourceImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionResourceImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionsClientImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveConnectionsImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointResourceImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointsClientImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveEndpointsImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/EnclaveResourceImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubResourceImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubsClientImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/TransitHubsImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesClientImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/VirtualEnclavesManagementClientImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadResourceImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadsClientImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/WorkloadsImpl.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/ApprovalResourceListResult.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/CommunityEndpointResourceListResult.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/CommunityResourceListResult.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveConnectionResourceListResult.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveEndpointResourceListResult.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/EnclaveResourceListResult.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/TransitHubResourceListResult.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/models/WorkloadResourceListResult.java","src/main/java/com/azure/resourcemanager/virtualenclaves/implementation/package-info.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ActionPerformed.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ActionType.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionRequest.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionRequestApprovalStatus.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalActionResponse.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequest.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequestApprovalStatus.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalCallbackRequestResourceRequestAction.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalDeletionCallbackRequest.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalDeletionCallbackRequestResourceRequestAction.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPatchModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPatchProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalPolicy.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalResource.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalSettings.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalSettingsPatchProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ApprovalStatus.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/Approvals.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/Approver.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CheckAddressSpaceAvailabilityRequest.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CheckAddressSpaceAvailabilityResponse.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/Communities.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointDestinationRule.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointPatchModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointPatchProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointProtocol.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpointResource.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityEndpoints.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPatchModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPatchProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityPropertiesPolicyOverride.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/CommunityResource.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/DestinationType.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/DiagnosticDestination.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveAddressSpacesModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionPatchModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionPatchProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionResource.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnectionState.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveConnections.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveDefaultSettingsModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveDefaultSettingsPatchModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointDestinationRule.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointPatchModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointPatchProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointProtocol.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpointResource.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveEndpoints.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveResource.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/EnclaveVirtualNetworkModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/FirewallSKU.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItem.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemEnforcement.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemOption.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/GovernedServiceItemPolicyAction.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModelJustification.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationModelMode.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/MaintenanceModeConfigurationPatchModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedOnBehalfOfConfiguration.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedServiceIdentity.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ManagedServiceIdentityType.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/MandatoryApprover.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/MoboBrokerResource.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/Operation.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/Operations.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/Origin.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/Principal.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/PrincipalType.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ProvisioningState.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/RequestMetadata.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/RequestMetadataUpdatableProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/RoleAssignmentItem.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/ServiceIdentifier.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/SubnetConfiguration.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubPatchModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubPatchProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubResource.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubState.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitHubs.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOption.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOptionParams.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/TransitOptionType.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/UserAssignedIdentity.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclavePatchModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclavePatchProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclaveProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/VirtualEnclaves.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadPatchModel.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadPatchProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadProperties.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/WorkloadResource.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/Workloads.java","src/main/java/com/azure/resourcemanager/virtualenclaves/models/package-info.java","src/main/java/com/azure/resourcemanager/virtualenclaves/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-virtualenclaves/proxy-config.json b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-virtualenclaves/proxy-config.json new file mode 100644 index 000000000000..228596c356ce --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-virtualenclaves/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.virtualenclaves.implementation.ApprovalsClientImpl$ApprovalsService"],["com.azure.resourcemanager.virtualenclaves.implementation.CommunitiesClientImpl$CommunitiesService"],["com.azure.resourcemanager.virtualenclaves.implementation.CommunityEndpointsClientImpl$CommunityEndpointsService"],["com.azure.resourcemanager.virtualenclaves.implementation.EnclaveConnectionsClientImpl$EnclaveConnectionsService"],["com.azure.resourcemanager.virtualenclaves.implementation.EnclaveEndpointsClientImpl$EnclaveEndpointsService"],["com.azure.resourcemanager.virtualenclaves.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.virtualenclaves.implementation.TransitHubsClientImpl$TransitHubsService"],["com.azure.resourcemanager.virtualenclaves.implementation.VirtualEnclavesClientImpl$VirtualEnclavesService"],["com.azure.resourcemanager.virtualenclaves.implementation.WorkloadsClientImpl$WorkloadsService"]] \ No newline at end of file diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-virtualenclaves/reflect-config.json b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-virtualenclaves/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-virtualenclaves/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/azure-resourcemanager-virtualenclaves.properties b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/azure-resourcemanager-virtualenclaves.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/main/resources/azure-resourcemanager-virtualenclaves.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalCreateOrUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalCreateOrUpdateSamples.java new file mode 100644 index 000000000000..3da838a0a08b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalCreateOrUpdateSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalProperties; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.Approver; +import com.azure.resourcemanager.virtualenclaves.models.RequestMetadata; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Approval CreateOrUpdate. + */ +public final class ApprovalCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_CreateOrUpdate.json + */ + /** + * Sample code: Approval_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + approvalCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.approvals() + .define("TestApprovals") + .withExistingResourceUri( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection") + .withProperties(new ApprovalProperties().withParentResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/virtualenclaves/TestMyEnclave") + .withGrandparentResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity") + .withApprovers(Arrays.asList(new Approver().withApproverEntraId("00000000-0000-0000-0000-000000000000") + .withActionPerformed(ActionPerformed.APPROVED) + .withLastUpdatedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")))) + .withTicketId("string") + .withCreatedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")) + .withStateChangedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")) + .withRequestMetadata(new RequestMetadata().withResourceAction("string") + .withApprovalCallbackRoute("approvalCallback") + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}") + .withApprovalStatus(ApprovalStatus.APPROVED))) + .create(); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalDeleteSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalDeleteSamples.java new file mode 100644 index 000000000000..e63bf80b50ef --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Approval Delete. + */ +public final class ApprovalDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_Delete.json + */ + /** + * Sample code: Approval_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void approvalDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.approvals() + .delete( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + "TestApprovals", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalGetSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalGetSamples.java new file mode 100644 index 000000000000..becb46ed04a9 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Approval Get. + */ +public final class ApprovalGetSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_Get.json + */ + /** + * Sample code: Approval_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void approvalGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.approvals() + .getWithResponse( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + "TestApprovals", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalListByParentSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalListByParentSamples.java new file mode 100644 index 000000000000..b530d256928f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalListByParentSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Approval ListByParent. + */ +public final class ApprovalListByParentSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_ListByParent.json + */ + /** + * Sample code: Approval_ListByParent. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void approvalListByParent(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.approvals() + .listByParent( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalNotifyInitiatorSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalNotifyInitiatorSamples.java new file mode 100644 index 000000000000..322e2912c5df --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalNotifyInitiatorSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequestApprovalStatus; + +/** + * Samples for Approval NotifyInitiator. + */ +public final class ApprovalNotifyInitiatorSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_NotifyInitiator.json + */ + /** + * Sample code: Approval_NotifyInitiator. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + approvalNotifyInitiator(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.approvals() + .notifyInitiator( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + "TestApprovals", + new ApprovalActionRequest().withApprovalStatus(ApprovalActionRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalUpdateSamples.java new file mode 100644 index 000000000000..b688f7f750bd --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalResource; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.Approver; +import com.azure.resourcemanager.virtualenclaves.models.RequestMetadataUpdatableProperties; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Approval Update. + */ +public final class ApprovalUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Approvals_Update.json + */ + /** + * Sample code: Approval_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void approvalUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + ApprovalResource resource = manager.approvals() + .getWithResponse( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + "TestApprovals", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new ApprovalPatchProperties().withParentResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/virtualenclaves/TestMyEnclave") + .withGrandparentResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity") + .withApprovers(Arrays.asList(new Approver().withApproverEntraId("00000000-0000-0000-0000-000000000000") + .withActionPerformed(ActionPerformed.APPROVED) + .withLastUpdatedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")))) + .withTicketId("string") + .withCreatedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")) + .withStateChangedAt(OffsetDateTime.parse("2023-03-17T20:43:17.760Z")) + .withRequestMetadata(new RequestMetadataUpdatableProperties().withResourceAction("string") + .withApprovalCallbackRoute("approvalCallback") + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}") + .withApprovalStatus(ApprovalStatus.APPROVED))) + .apply(); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityCheckAddressSpaceAvailabilitySamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityCheckAddressSpaceAvailabilitySamples.java new file mode 100644 index 000000000000..dfe653cbc6d1 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityCheckAddressSpaceAvailabilitySamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import java.util.Arrays; + +/** + * Samples for Community CheckAddressSpaceAvailability. + */ +public final class CommunityCheckAddressSpaceAvailabilitySamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_PostCheckAddressSpaceAvailability.json + */ + /** + * Sample code: Community_CheckAddressSpaceAvailability. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityCheckAddressSpaceAvailability( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities() + .checkAddressSpaceAvailabilityWithResponse("rgopenapi", "TestMyCommunity", + new CheckAddressSpaceAvailabilityRequest().withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/communities/TestMyCommunity") + .withEnclaveVirtualNetwork(new EnclaveVirtualNetworkModel().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withSubnetName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true)), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityCreateOrUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityCreateOrUpdateSamples.java new file mode 100644 index 000000000000..e0b69e6175ff --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityCreateOrUpdateSamples.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalSettings; +import com.azure.resourcemanager.virtualenclaves.models.CommunityProperties; +import com.azure.resourcemanager.virtualenclaves.models.FirewallSKU; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Community CreateOrUpdate. + */ +public final class CommunityCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_CreateOrUpdate.json + */ + /** + * Sample code: Community_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities() + .define("TestMyCommunity") + .withRegion("westcentralus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new CommunityProperties().withAddressSpace("10.0.0.0/24") + .withDnsServers(Arrays.asList("azure.net")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withServiceId(ServiceIdentifier.AKS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.APP_SERVICE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.CONTAINER_REGISTRY) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.KEY_VAULT) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.MICROSOFT_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.MONITORING) + .withOption(GovernedServiceItemOption.fromString("Not Applicable")) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.POSTGRE_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.SERVICE_BUS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.STORAGE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.AZURE_FIREWALLS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.INSIGHTS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.LOGIC) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.DATA_CONNECTORS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE))) + .withCommunityRoleAssignments(Arrays.asList(new RoleAssignmentItem() + .withRoleDefinitionId("b24988ac-6180-42a0-ab88-20f7382dd24c") + .withPrincipals(Arrays.asList( + new Principal().withId("01234567-89ab-ef01-2345-0123456789ab").withType(PrincipalType.GROUP), + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c0").withType(PrincipalType.USER))), + new RoleAssignmentItem().withRoleDefinitionId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER))))) + .withFirewallSku(FirewallSKU.STANDARD) + .withApprovalSettings(new ApprovalSettings().withEndpointCreation(ApprovalPolicy.NOT_REQUIRED) + .withEndpointUpdate(ApprovalPolicy.REQUIRED) + .withEndpointDeletion(ApprovalPolicy.NOT_REQUIRED) + .withConnectionCreation(ApprovalPolicy.REQUIRED) + .withConnectionUpdate(ApprovalPolicy.REQUIRED) + .withConnectionDeletion(ApprovalPolicy.NOT_REQUIRED) + .withEnclaveCreation(ApprovalPolicy.NOT_REQUIRED) + .withEnclaveDeletion(ApprovalPolicy.NOT_REQUIRED) + .withMaintenanceMode(ApprovalPolicy.NOT_REQUIRED) + .withServiceCatalogDeployment(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalCreation(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalAction(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalDeletion(ApprovalPolicy.NOT_REQUIRED) + .withMandatoryApprovers(Arrays + .asList(new MandatoryApprover().withApproverEntraId("00000000-0000-0000-0000-000000000000"))) + .withMinimumApproversRequired(0L)) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationModel() + .withMode(MaintenanceModeConfigurationModelMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationModelJustification.OFF))) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityDeleteSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityDeleteSamples.java new file mode 100644 index 000000000000..719cd0d0d90a --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Community Delete. + */ +public final class CommunityDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_Delete.json + */ + /** + * Sample code: Community_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities().delete("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsCreateOrUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..d91fa7369e7a --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsCreateOrUpdateSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CommunityEndpoints CreateOrUpdate. + */ +public final class CommunityEndpointsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_CreateOrUpdate.json + */ + /** + * Sample code: CommunityEndpoints_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityEndpointsCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .define("TestMyCommunityEndpoint") + .withRegion("West US") + .withExistingCommunity("rgopenapi", "TestMyCommunity") + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new CommunityEndpointProperties().withRuleCollection( + Arrays.asList(new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDNTAG) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.TCP)) + .withTransitHubResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity/transitHubs/TestThName") + .withDestination("foo.example.com") + .withPorts("443")))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsDeleteSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsDeleteSamples.java new file mode 100644 index 000000000000..77a8201c50c8 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for CommunityEndpoints Delete. + */ +public final class CommunityEndpointsDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_Delete.json + */ + /** + * Sample code: CommunityEndpoints_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityEndpointsDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .delete("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsGetSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsGetSamples.java new file mode 100644 index 000000000000..ca7fb2e65900 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for CommunityEndpoints Get. + */ +public final class CommunityEndpointsGetSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_Get.json + */ + /** + * Sample code: CommunityEndpoints_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityEndpointsGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalCreationSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalCreationSamples.java new file mode 100644 index 000000000000..e8f8a565462f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalCreationSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for CommunityEndpoints HandleApprovalCreation. + */ +public final class CommunityEndpointsHandleApprovalCreationSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_HandleApprovalCreation.json + */ + /** + * Sample code: CommunityEndpoints_HandleApprovalCreation. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityEndpointsHandleApprovalCreation( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .handleApprovalCreation("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalDeletionSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalDeletionSamples.java new file mode 100644 index 000000000000..e04320bd16bd --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalDeletionSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for CommunityEndpoints HandleApprovalDeletion. + */ +public final class CommunityEndpointsHandleApprovalDeletionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_HandleApprovalDeletion.json + */ + /** + * Sample code: CommunityEndpoints_HandleApprovalDeletion. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityEndpointsHandleApprovalDeletion( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .handleApprovalDeletion( + "rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListByCommunityResourceSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListByCommunityResourceSamples.java new file mode 100644 index 000000000000..7c31780dc0ee --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListByCommunityResourceSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for CommunityEndpoints ListByCommunityResource. + */ +public final class CommunityEndpointsListByCommunityResourceSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_ListByCommunityResource.json + */ + /** + * Sample code: CommunityEndpoints_ListByCommunityResource. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityEndpointsListByCommunityResource( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints() + .listByCommunityResource("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListBySubscriptionSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListBySubscriptionSamples.java new file mode 100644 index 000000000000..c5b78d8835f7 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListBySubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for CommunityEndpoints ListBySubscription. + */ +public final class CommunityEndpointsListBySubscriptionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_ListBySubscription.json + */ + /** + * Sample code: CommunityEndpoints_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityEndpointsListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communityEndpoints().listBySubscription("TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsUpdateSamples.java new file mode 100644 index 000000000000..7484717f0fc4 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsUpdateSamples.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointResource; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CommunityEndpoints Update. + */ +public final class CommunityEndpointsUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/CommunityEndpoints_Update.json + */ + /** + * Sample code: CommunityEndpoints_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityEndpointsUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + CommunityEndpointResource resource = manager.communityEndpoints() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new CommunityEndpointPatchProperties().withRuleCollection( + Arrays.asList(new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDN) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.TCP)) + .withTransitHubResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity/transitHubs/TestThName") + .withDestination("foo.example.com") + .withPorts("443")))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityGetByResourceGroupSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityGetByResourceGroupSamples.java new file mode 100644 index 000000000000..626cb4876036 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Community GetByResourceGroup. + */ +public final class CommunityGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_Get.json + */ + /** + * Sample code: Community_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities() + .getByResourceGroupWithResponse("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityListByResourceGroupSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityListByResourceGroupSamples.java new file mode 100644 index 000000000000..bf58ebc09ae9 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Community ListByResourceGroup. + */ +public final class CommunityListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_ListByResourceGroup.json + */ + /** + * Sample code: Community_ListByResourceGroup. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityListByResourceGroup(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityListSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityListSamples.java new file mode 100644 index 000000000000..f998a7267885 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Community List. + */ +public final class CommunityListSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_ListBySubscription.json + */ + /** + * Sample code: Community_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + communityListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.communities().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityUpdateSamples.java new file mode 100644 index 000000000000..a19845607b1a --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityUpdateSamples.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.CommunityPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityResource; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Community Update. + */ +public final class CommunityUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Community_Update.json + */ + /** + * Sample code: Community_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void communityUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + CommunityResource resource = manager.communities() + .getByResourceGroupWithResponse("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new CommunityPatchProperties().withDnsServers(Arrays.asList("azure.net")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withServiceId(ServiceIdentifier.AKS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.APP_SERVICE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.CONTAINER_REGISTRY) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.KEY_VAULT) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.MICROSOFT_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.MONITORING) + .withOption(GovernedServiceItemOption.fromString("Not Applicable")) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.POSTGRE_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.SERVICE_BUS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.STORAGE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.AZURE_FIREWALLS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.INSIGHTS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.LOGIC) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.DATA_CONNECTORS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE))) + .withCommunityRoleAssignments(Arrays.asList(new RoleAssignmentItem() + .withRoleDefinitionId("b24988ac-6180-42a0-ab88-20f7382dd24c") + .withPrincipals(Arrays.asList( + new Principal().withId("01234567-89ab-ef01-2345-0123456789ab").withType(PrincipalType.GROUP), + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c0").withType(PrincipalType.USER))), + new RoleAssignmentItem().withRoleDefinitionId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER)))))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionCreateOrUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionCreateOrUpdateSamples.java new file mode 100644 index 000000000000..b1526c04164e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionCreateOrUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveConnection CreateOrUpdate. + */ +public final class EnclaveConnectionCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_CreateOrUpdate.json + */ + /** + * Sample code: EnclaveConnection_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveConnectionCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections() + .define("TestMyEnclaveConnection") + .withRegion("West US") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new EnclaveConnectionProperties().withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity") + .withSourceResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/virtualenclaves/TestMyEnclave") + .withSourceCidr("10.0.0.0/24") + .withDestinationEndpointId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/virtualenclaves/TestMyEnclave/enclaveendpoints/TestMyEnclaveEndpoint")) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionDeleteSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionDeleteSamples.java new file mode 100644 index 000000000000..5c92d9c356a1 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for EnclaveConnection Delete. + */ +public final class EnclaveConnectionDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_Delete.json + */ + /** + * Sample code: EnclaveConnection_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveConnectionDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections().delete("rgopenapi", "TestMyEnclaveConnection", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionGetByResourceGroupSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionGetByResourceGroupSamples.java new file mode 100644 index 000000000000..25f9cdef83af --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for EnclaveConnection GetByResourceGroup. + */ +public final class EnclaveConnectionGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_Get.json + */ + /** + * Sample code: EnclaveConnection_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveConnectionGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclaveConnection", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionHandleApprovalCreationSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionHandleApprovalCreationSamples.java new file mode 100644 index 000000000000..4bb1b08cbffe --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionHandleApprovalCreationSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveConnection HandleApprovalCreation. + */ +public final class EnclaveConnectionHandleApprovalCreationSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_HandleApprovalCreation.json + */ + /** + * Sample code: EnclaveConnection_HandleApprovalCreation. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveConnectionHandleApprovalCreation( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections() + .handleApprovalCreation("rgopenapi", "TestMyEnclaveConnection", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED) + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionHandleApprovalDeletionSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionHandleApprovalDeletionSamples.java new file mode 100644 index 000000000000..970325d7e8b0 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionHandleApprovalDeletionSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveConnection HandleApprovalDeletion. + */ +public final class EnclaveConnectionHandleApprovalDeletionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_HandleApprovalDeletion.json + */ + /** + * Sample code: EnclaveConnection_HandleApprovalDeletion. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveConnectionHandleApprovalDeletion( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections() + .handleApprovalDeletion("rgopenapi", "TestMyEnclaveConnection", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionListByResourceGroupSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionListByResourceGroupSamples.java new file mode 100644 index 000000000000..537d889441d9 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for EnclaveConnection ListByResourceGroup. + */ +public final class EnclaveConnectionListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_ListByResourceGroup.json + */ + /** + * Sample code: EnclaveConnection_ListByResourceGroup. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveConnectionListByResourceGroup(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionListSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionListSamples.java new file mode 100644 index 000000000000..14972b57c04d --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for EnclaveConnection List. + */ +public final class EnclaveConnectionListSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_ListBySubscription.json + */ + /** + * Sample code: EnclaveConnection_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveConnectionListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveConnections().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionUpdateSamples.java new file mode 100644 index 000000000000..a8893780f4d0 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveConnection Update. + */ +public final class EnclaveConnectionUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveConnection_Update.json + */ + /** + * Sample code: EnclaveConnection_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveConnectionUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + EnclaveConnectionResource resource = manager.enclaveConnections() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclaveConnection", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new EnclaveConnectionPatchProperties().withSourceCidr("10.0.0.0/24")) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsCreateOrUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..4311090de730 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsCreateOrUpdateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveEndpoints CreateOrUpdate. + */ +public final class EnclaveEndpointsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_CreateOrUpdate.json + */ + /** + * Sample code: EnclaveEndpoints_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveEndpointsCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .define("TestMyEnclaveEndpoint") + .withRegion("West US") + .withExistingVirtualEnclave("rgopenapi", "TestMyEnclave") + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new EnclaveEndpointProperties().withRuleCollection(Arrays + .asList(new EnclaveEndpointDestinationRule().withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP)) + .withEndpointRuleName("54CEECEF-2C30-488E-946F-D20F414D99BA") + .withDestination("10.0.0.0/24") + .withPorts("443")))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsDeleteSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsDeleteSamples.java new file mode 100644 index 000000000000..42fa6035b1f6 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for EnclaveEndpoints Delete. + */ +public final class EnclaveEndpointsDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_Delete.json + */ + /** + * Sample code: EnclaveEndpoints_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveEndpointsDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .delete("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsGetSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsGetSamples.java new file mode 100644 index 000000000000..2a840167f51b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for EnclaveEndpoints Get. + */ +public final class EnclaveEndpointsGetSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_Get.json + */ + /** + * Sample code: EnclaveEndpoints_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveEndpointsGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalCreationSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalCreationSamples.java new file mode 100644 index 000000000000..3357737aa83c --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalCreationSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveEndpoints HandleApprovalCreation. + */ +public final class EnclaveEndpointsHandleApprovalCreationSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_HandleApprovalCreation.json + */ + /** + * Sample code: EnclaveEndpoints_HandleApprovalCreation. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveEndpointsHandleApprovalCreation( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .handleApprovalCreation("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalDeletionSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalDeletionSamples.java new file mode 100644 index 000000000000..3580010db48f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalDeletionSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveEndpoints HandleApprovalDeletion. + */ +public final class EnclaveEndpointsHandleApprovalDeletionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_HandleApprovalDeletion.json + */ + /** + * Sample code: EnclaveEndpoints_HandleApprovalDeletion. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveEndpointsHandleApprovalDeletion( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .handleApprovalDeletion( + "rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListByEnclaveResourceSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListByEnclaveResourceSamples.java new file mode 100644 index 000000000000..2154d5dac546 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListByEnclaveResourceSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for EnclaveEndpoints ListByEnclaveResource. + */ +public final class EnclaveEndpointsListByEnclaveResourceSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_ListByEnclaveResource.json + */ + /** + * Sample code: EnclaveEndpoints_ListByEnclaveResource. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void enclaveEndpointsListByEnclaveResource( + com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints() + .listByEnclaveResource("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListBySubscriptionSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListBySubscriptionSamples.java new file mode 100644 index 000000000000..ded00b0da75f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListBySubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for EnclaveEndpoints ListBySubscription. + */ +public final class EnclaveEndpointsListBySubscriptionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_ListBySubscription.json + */ + /** + * Sample code: EnclaveEndpoints_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveEndpointsListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.enclaveEndpoints().listBySubscription("TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsUpdateSamples.java new file mode 100644 index 000000000000..3d5ab76fd314 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsUpdateSamples.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointResource; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveEndpoints Update. + */ +public final class EnclaveEndpointsUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/EnclaveEndpoints_Update.json + */ + /** + * Sample code: EnclaveEndpoints_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + enclaveEndpointsUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + EnclaveEndpointResource resource = manager.enclaveEndpoints() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new EnclaveEndpointPatchProperties().withRuleCollection(Arrays + .asList(new EnclaveEndpointDestinationRule().withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP)) + .withEndpointRuleName("54CEECEF-2C30-488E-946F-D20F414D99BA") + .withDestination("10.0.0.0/24") + .withPorts("443")))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/OperationsListSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/OperationsListSamples.java new file mode 100644 index 000000000000..2fb84679fe64 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void operationsList(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubCreateOrUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a9b263f2367a --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubCreateOrUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.TransitHubProperties; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOption; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for TransitHub CreateOrUpdate. + */ +public final class TransitHubCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_CreateOrUpdate.json + */ + /** + * Sample code: TransitHub_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + transitHubCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.transitHubs() + .define("TestThName") + .withRegion("westcentralus") + .withExistingCommunity("rgopenapi", "TestMyCommunity") + .withTags(mapOf("Tag1", "Value1")) + .withProperties(new TransitHubProperties().withState(TransitHubState.PENDING_APPROVAL) + .withTransitOption(new TransitOption().withType(TransitOptionType.EXPRESS_ROUTE) + .withParams(new TransitOptionParams().withScaleUnits(1L)))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubDeleteSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubDeleteSamples.java new file mode 100644 index 000000000000..a300a7630493 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for TransitHub Delete. + */ +public final class TransitHubDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_Delete.json + */ + /** + * Sample code: TransitHub_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void transitHubDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.transitHubs().delete("rgopenapi", "TestMyCommunity", "TestThName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubGetSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubGetSamples.java new file mode 100644 index 000000000000..7123e59fbf30 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for TransitHub Get. + */ +public final class TransitHubGetSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_Get.json + */ + /** + * Sample code: TransitHub_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void transitHubGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.transitHubs() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestThName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubListByCommunityResourceSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubListByCommunityResourceSamples.java new file mode 100644 index 000000000000..618e0a8ea763 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubListByCommunityResourceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for TransitHub ListByCommunityResource. + */ +public final class TransitHubListByCommunityResourceSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_ListByCommunityResource.json + */ + /** + * Sample code: TransitHub_ListByCommunityResource. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + transitHubListByCommunityResource(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.transitHubs().listByCommunityResource("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubListBySubscriptionSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubListBySubscriptionSamples.java new file mode 100644 index 000000000000..93ccac8657aa --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubListBySubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for TransitHub ListBySubscription. + */ +public final class TransitHubListBySubscriptionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_ListBySubscription.json + */ + /** + * Sample code: TransitHub_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + transitHubListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.transitHubs().listBySubscription("TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubUpdateSamples.java new file mode 100644 index 000000000000..f3af5407e0c5 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubResource; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOption; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for TransitHub Update. + */ +public final class TransitHubUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/TransitHub_Update.json + */ + /** + * Sample code: TransitHub_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void transitHubUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + TransitHubResource resource = manager.transitHubs() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestThName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key4278", "fakeTokenPlaceholder")) + .withProperties(new TransitHubPatchProperties().withState(TransitHubState.PENDING_APPROVAL) + .withTransitOption(new TransitOption().withType(TransitOptionType.EXPRESS_ROUTE) + .withParams(new TransitOptionParams().withScaleUnits(1L)))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveCreateOrUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveCreateOrUpdateSamples.java new file mode 100644 index 000000000000..930bfe9f4bb7 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveCreateOrUpdateSamples.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.DiagnosticDestination; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveDefaultSettingsModel; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclaveProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for VirtualEnclave CreateOrUpdate. + */ +public final class VirtualEnclaveCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_CreateOrUpdate.json + */ + /** + * Sample code: VirtualEnclave_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + virtualEnclaveCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves() + .define("TestMyEnclave") + .withRegion("westcentralus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("Tag1", "Value1")) + .withProperties(new VirtualEnclaveProperties() + .withEnclaveVirtualNetwork(new EnclaveVirtualNetworkModel().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withSubnetName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true)) + .withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/communities/TestMyCommunity") + .withBastionEnabled(true) + .withEnclaveRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("b24988ac-6180-42a0-ab88-20f7382dd24c") + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER), + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c0") + .withType(PrincipalType.USER))), + new RoleAssignmentItem().withRoleDefinitionId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER))))) + .withWorkloadRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("d73bb868-a0df-4d4d-bd69-98a00b01fccb") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))), + new RoleAssignmentItem().withRoleDefinitionId("fb879df8-f326-4884-b1cf-06f3ad86be52") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))))) + .withEnclaveDefaultSettings( + new EnclaveDefaultSettingsModel().withDiagnosticDestination(DiagnosticDestination.BOTH)) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationModel() + .withMode(MaintenanceModeConfigurationModelMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationModelJustification.OFF))) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveDeleteSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveDeleteSamples.java new file mode 100644 index 000000000000..c57372d69eac --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for VirtualEnclave Delete. + */ +public final class VirtualEnclaveDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_Delete.json + */ + /** + * Sample code: VirtualEnclave_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void virtualEnclaveDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves().delete("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveGetByResourceGroupSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveGetByResourceGroupSamples.java new file mode 100644 index 000000000000..c47a178b7d03 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for VirtualEnclave GetByResourceGroup. + */ +public final class VirtualEnclaveGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_Get.json + */ + /** + * Sample code: VirtualEnclave_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void virtualEnclaveGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveHandleApprovalCreationSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveHandleApprovalCreationSamples.java new file mode 100644 index 000000000000..6a00dffd7ff3 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveHandleApprovalCreationSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for VirtualEnclave HandleApprovalCreation. + */ +public final class VirtualEnclaveHandleApprovalCreationSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_HandleApprovalCreation.json + */ + /** + * Sample code: VirtualEnclave_HandleApprovalCreation. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + virtualEnclaveHandleApprovalCreation(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves() + .handleApprovalCreation("rgopenapi", "TestMyEnclave", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED) + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveHandleApprovalDeletionSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveHandleApprovalDeletionSamples.java new file mode 100644 index 000000000000..0dee46479217 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveHandleApprovalDeletionSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for VirtualEnclave HandleApprovalDeletion. + */ +public final class VirtualEnclaveHandleApprovalDeletionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_HandleApprovalDeletion.json + */ + /** + * Sample code: VirtualEnclave_HandleApprovalDeletion. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + virtualEnclaveHandleApprovalDeletion(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves() + .handleApprovalDeletion("rgopenapi", "TestMyEnclave", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveListByResourceGroupSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveListByResourceGroupSamples.java new file mode 100644 index 000000000000..86760affaab0 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for VirtualEnclave ListByResourceGroup. + */ +public final class VirtualEnclaveListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_ListByResourceGroup.json + */ + /** + * Sample code: VirtualEnclave_ListByResourceGroup. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + virtualEnclaveListByResourceGroup(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveListSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveListSamples.java new file mode 100644 index 000000000000..a32b522f0e16 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for VirtualEnclave List. + */ +public final class VirtualEnclaveListSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_ListBySubscription.json + */ + /** + * Sample code: VirtualEnclave_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + virtualEnclaveListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.virtualEnclaves().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveUpdateSamples.java new file mode 100644 index 000000000000..fba17719002f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclaveUpdateSamples.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.DiagnosticDestination; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveDefaultSettingsPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveResource; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for VirtualEnclave Update. + */ +public final class VirtualEnclaveUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/VirtualEnclave_Update.json + */ + /** + * Sample code: VirtualEnclave_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void virtualEnclaveUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + EnclaveResource resource = manager.virtualEnclaves() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("Tag1", "Value1")) + .withProperties(new VirtualEnclavePatchProperties() + .withEnclaveVirtualNetwork(new EnclaveVirtualNetworkModel().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withSubnetName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true)) + .withBastionEnabled(true) + .withEnclaveRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("b24988ac-6180-42a0-ab88-20f7382dd24c") + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER), + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c0") + .withType(PrincipalType.USER))), + new RoleAssignmentItem().withRoleDefinitionId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER))))) + .withWorkloadRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("d73bb868-a0df-4d4d-bd69-98a00b01fccb") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))), + new RoleAssignmentItem().withRoleDefinitionId("fb879df8-f326-4884-b1cf-06f3ad86be52") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))))) + .withEnclaveDefaultSettings( + new EnclaveDefaultSettingsPatchModel().withDiagnosticDestination(DiagnosticDestination.BOTH)) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationPatchModel() + .withMode(MaintenanceModeConfigurationModelMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationModelJustification.OFF))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadCreateOrUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadCreateOrUpdateSamples.java new file mode 100644 index 000000000000..900e38e4f2c7 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadCreateOrUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.WorkloadProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Workload CreateOrUpdate. + */ +public final class WorkloadCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_CreateOrUpdate.json + */ + /** + * Sample code: Workload_CreateOrUpdate. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + workloadCreateOrUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.workloads() + .define("TestMyWorkload") + .withRegion("westcentralus") + .withExistingVirtualEnclave("rgopenapi", "TestMyEnclave") + .withTags(mapOf("TestKey", "fakeTokenPlaceholder")) + .withProperties(new WorkloadProperties().withResourceGroupCollection(Arrays.asList())) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadDeleteSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadDeleteSamples.java new file mode 100644 index 000000000000..3bac775b45da --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Workload Delete. + */ +public final class WorkloadDeleteSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_Delete.json + */ + /** + * Sample code: Workload_Delete. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void workloadDelete(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.workloads().delete("rgopenapi", "TestMyEnclave", "TestMyWorkload", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadGetSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadGetSamples.java new file mode 100644 index 000000000000..f37c643c1d10 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Workload Get. + */ +public final class WorkloadGetSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_Get.json + */ + /** + * Sample code: Workload_Get. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void workloadGet(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.workloads() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyWorkload", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadListByEnclaveResourceSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadListByEnclaveResourceSamples.java new file mode 100644 index 000000000000..469360122043 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadListByEnclaveResourceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Workload ListByEnclaveResource. + */ +public final class WorkloadListByEnclaveResourceSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_ListByEnclaveResource.json + */ + /** + * Sample code: Workload_ListByEnclaveResource. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + workloadListByEnclaveResource(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.workloads().listByEnclaveResource("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadListBySubscriptionSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadListBySubscriptionSamples.java new file mode 100644 index 000000000000..502ec37f6d0e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadListBySubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +/** + * Samples for Workload ListBySubscription. + */ +public final class WorkloadListBySubscriptionSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_ListBySubscription.json + */ + /** + * Sample code: Workload_ListBySubscription. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void + workloadListBySubscription(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + manager.workloads().listBySubscription("TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadUpdateSamples.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadUpdateSamples.java new file mode 100644 index 000000000000..3e76a132eee3 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/samples/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadResource; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Workload Update. + */ +public final class WorkloadUpdateSamples { + /* + * x-ms-original-file: 2025-05-01-preview/Workload_Update.json + */ + /** + * Sample code: Workload_Update. + * + * @param manager Entry point to VirtualEnclavesManager. + */ + public static void workloadUpdate(com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager manager) { + WorkloadResource resource = manager.workloads() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyWorkload", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key9465", "fakeTokenPlaceholder")) + .withProperties(new WorkloadPatchProperties().withResourceGroupCollection(Arrays.asList("g"))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalActionRequestTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalActionRequestTests.java new file mode 100644 index 000000000000..9120a565c89e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalActionRequestTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequestApprovalStatus; +import org.junit.jupiter.api.Assertions; + +public final class ApprovalActionRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApprovalActionRequest model + = BinaryData.fromString("{\"approvalStatus\":\"Rejected\"}").toObject(ApprovalActionRequest.class); + Assertions.assertEquals(ApprovalActionRequestApprovalStatus.REJECTED, model.approvalStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApprovalActionRequest model + = new ApprovalActionRequest().withApprovalStatus(ApprovalActionRequestApprovalStatus.REJECTED); + model = BinaryData.fromObject(model).toObject(ApprovalActionRequest.class); + Assertions.assertEquals(ApprovalActionRequestApprovalStatus.REJECTED, model.approvalStatus()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalActionResponseInnerTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalActionResponseInnerTests.java new file mode 100644 index 000000000000..2bf9b143f89e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalActionResponseInnerTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalActionResponseInner; +import org.junit.jupiter.api.Assertions; + +public final class ApprovalActionResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApprovalActionResponseInner model + = BinaryData.fromString("{\"message\":\"n\"}").toObject(ApprovalActionResponseInner.class); + Assertions.assertEquals("n", model.message()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalCallbackRequestTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalCallbackRequestTests.java new file mode 100644 index 000000000000..0fdd8b26d2ce --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalCallbackRequestTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; +import org.junit.jupiter.api.Assertions; + +public final class ApprovalCallbackRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApprovalCallbackRequest model = BinaryData.fromString( + "{\"resourceRequestAction\":\"Reset\",\"approvalStatus\":\"Rejected\",\"approvalCallbackPayload\":\"gqgitxmedjvcsl\"}") + .toObject(ApprovalCallbackRequest.class); + Assertions.assertEquals(ApprovalCallbackRequestResourceRequestAction.RESET, model.resourceRequestAction()); + Assertions.assertEquals(ApprovalCallbackRequestApprovalStatus.REJECTED, model.approvalStatus()); + Assertions.assertEquals("gqgitxmedjvcsl", model.approvalCallbackPayload()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApprovalCallbackRequest model = new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.RESET) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.REJECTED) + .withApprovalCallbackPayload("gqgitxmedjvcsl"); + model = BinaryData.fromObject(model).toObject(ApprovalCallbackRequest.class); + Assertions.assertEquals(ApprovalCallbackRequestResourceRequestAction.RESET, model.resourceRequestAction()); + Assertions.assertEquals(ApprovalCallbackRequestApprovalStatus.REJECTED, model.approvalStatus()); + Assertions.assertEquals("gqgitxmedjvcsl", model.approvalCallbackPayload()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalDeletionCallbackRequestTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalDeletionCallbackRequestTests.java new file mode 100644 index 000000000000..7fbdc5fb8aaa --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalDeletionCallbackRequestTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; +import org.junit.jupiter.api.Assertions; + +public final class ApprovalDeletionCallbackRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApprovalDeletionCallbackRequest model = BinaryData.fromString("{\"resourceRequestAction\":\"Create\"}") + .toObject(ApprovalDeletionCallbackRequest.class); + Assertions.assertEquals(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE, + model.resourceRequestAction()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApprovalDeletionCallbackRequest model = new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE); + model = BinaryData.fromObject(model).toObject(ApprovalDeletionCallbackRequest.class); + Assertions.assertEquals(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE, + model.resourceRequestAction()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalPatchModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalPatchModelTests.java new file mode 100644 index 000000000000..71bf5876137f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalPatchModelTests.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.Approver; +import com.azure.resourcemanager.virtualenclaves.models.RequestMetadataUpdatableProperties; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApprovalPatchModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApprovalPatchModel model = BinaryData.fromString( + "{\"properties\":{\"parentResourceId\":\"lkdghr\",\"grandparentResourceId\":\"uutlwxezwzhok\",\"approvers\":[{\"approverEntraId\":\"nhhtql\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-02-03T16:42:47Z\"},{\"approverEntraId\":\"ppipifhpfeoa\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-07-22T11:56:16Z\"},{\"approverEntraId\":\"xtxj\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-04-16T00:22:41Z\"},{\"approverEntraId\":\"afidltugsres\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-08-27T02:15:10Z\"}],\"ticketId\":\"oiftxfkfwegprh\",\"createdAt\":\"2021-01-06T18:32:33Z\",\"stateChangedAt\":\"2021-12-03T09:50:25Z\",\"requestMetadata\":{\"resourceAction\":\"ucb\",\"approvalCallbackRoute\":\"tgdqohmcwsldriz\",\"approvalCallbackPayload\":\"pwbralllibphbqz\",\"approvalStatus\":\"Approved\"}}}") + .toObject(ApprovalPatchModel.class); + Assertions.assertEquals("lkdghr", model.properties().parentResourceId()); + Assertions.assertEquals("uutlwxezwzhok", model.properties().grandparentResourceId()); + Assertions.assertEquals("nhhtql", model.properties().approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, model.properties().approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-03T16:42:47Z"), + model.properties().approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("oiftxfkfwegprh", model.properties().ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-06T18:32:33Z"), model.properties().createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-12-03T09:50:25Z"), model.properties().stateChangedAt()); + Assertions.assertEquals("ucb", model.properties().requestMetadata().resourceAction()); + Assertions.assertEquals("tgdqohmcwsldriz", model.properties().requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("pwbralllibphbqz", model.properties().requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.APPROVED, model.properties().requestMetadata().approvalStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApprovalPatchModel model + = new ApprovalPatchModel().withProperties(new ApprovalPatchProperties().withParentResourceId("lkdghr") + .withGrandparentResourceId("uutlwxezwzhok") + .withApprovers(Arrays.asList( + new Approver().withApproverEntraId("nhhtql") + .withActionPerformed(ActionPerformed.REJECTED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-02-03T16:42:47Z")), + new Approver().withApproverEntraId("ppipifhpfeoa") + .withActionPerformed(ActionPerformed.APPROVED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-07-22T11:56:16Z")), + new Approver().withApproverEntraId("xtxj") + .withActionPerformed(ActionPerformed.APPROVED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-04-16T00:22:41Z")), + new Approver().withApproverEntraId("afidltugsres") + .withActionPerformed(ActionPerformed.REJECTED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-08-27T02:15:10Z")))) + .withTicketId("oiftxfkfwegprh") + .withCreatedAt(OffsetDateTime.parse("2021-01-06T18:32:33Z")) + .withStateChangedAt(OffsetDateTime.parse("2021-12-03T09:50:25Z")) + .withRequestMetadata(new RequestMetadataUpdatableProperties().withResourceAction("ucb") + .withApprovalCallbackRoute("tgdqohmcwsldriz") + .withApprovalCallbackPayload("pwbralllibphbqz") + .withApprovalStatus(ApprovalStatus.APPROVED))); + model = BinaryData.fromObject(model).toObject(ApprovalPatchModel.class); + Assertions.assertEquals("lkdghr", model.properties().parentResourceId()); + Assertions.assertEquals("uutlwxezwzhok", model.properties().grandparentResourceId()); + Assertions.assertEquals("nhhtql", model.properties().approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, model.properties().approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-03T16:42:47Z"), + model.properties().approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("oiftxfkfwegprh", model.properties().ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-06T18:32:33Z"), model.properties().createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-12-03T09:50:25Z"), model.properties().stateChangedAt()); + Assertions.assertEquals("ucb", model.properties().requestMetadata().resourceAction()); + Assertions.assertEquals("tgdqohmcwsldriz", model.properties().requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("pwbralllibphbqz", model.properties().requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.APPROVED, model.properties().requestMetadata().approvalStatus()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalPatchPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalPatchPropertiesTests.java new file mode 100644 index 000000000000..2c6fd9adf42c --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalPatchPropertiesTests.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.Approver; +import com.azure.resourcemanager.virtualenclaves.models.RequestMetadataUpdatableProperties; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApprovalPatchPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApprovalPatchProperties model = BinaryData.fromString( + "{\"parentResourceId\":\"kakankjpdnjzhaj\",\"grandparentResourceId\":\"lhjlmuoyxprimr\",\"approvers\":[{\"approverEntraId\":\"teecjmeislst\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-10-17T18:13:46Z\"},{\"approverEntraId\":\"lwxdzaum\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-01-28T10:10:06Z\"}],\"ticketId\":\"guufuzboyjathwtz\",\"createdAt\":\"2021-01-15T12:49:43Z\",\"stateChangedAt\":\"2021-08-25T10:05:56Z\",\"requestMetadata\":{\"resourceAction\":\"mwmdxmebwjscjpa\",\"approvalCallbackRoute\":\"xveabf\",\"approvalCallbackPayload\":\"nmwmqtibx\",\"approvalStatus\":\"Pending\"}}") + .toObject(ApprovalPatchProperties.class); + Assertions.assertEquals("kakankjpdnjzhaj", model.parentResourceId()); + Assertions.assertEquals("lhjlmuoyxprimr", model.grandparentResourceId()); + Assertions.assertEquals("teecjmeislst", model.approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, model.approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-17T18:13:46Z"), model.approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("guufuzboyjathwtz", model.ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-15T12:49:43Z"), model.createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-25T10:05:56Z"), model.stateChangedAt()); + Assertions.assertEquals("mwmdxmebwjscjpa", model.requestMetadata().resourceAction()); + Assertions.assertEquals("xveabf", model.requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("nmwmqtibx", model.requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.PENDING, model.requestMetadata().approvalStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApprovalPatchProperties model = new ApprovalPatchProperties().withParentResourceId("kakankjpdnjzhaj") + .withGrandparentResourceId("lhjlmuoyxprimr") + .withApprovers(Arrays.asList( + new Approver().withApproverEntraId("teecjmeislst") + .withActionPerformed(ActionPerformed.REJECTED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-10-17T18:13:46Z")), + new Approver().withApproverEntraId("lwxdzaum") + .withActionPerformed(ActionPerformed.APPROVED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-01-28T10:10:06Z")))) + .withTicketId("guufuzboyjathwtz") + .withCreatedAt(OffsetDateTime.parse("2021-01-15T12:49:43Z")) + .withStateChangedAt(OffsetDateTime.parse("2021-08-25T10:05:56Z")) + .withRequestMetadata(new RequestMetadataUpdatableProperties().withResourceAction("mwmdxmebwjscjpa") + .withApprovalCallbackRoute("xveabf") + .withApprovalCallbackPayload("nmwmqtibx") + .withApprovalStatus(ApprovalStatus.PENDING)); + model = BinaryData.fromObject(model).toObject(ApprovalPatchProperties.class); + Assertions.assertEquals("kakankjpdnjzhaj", model.parentResourceId()); + Assertions.assertEquals("lhjlmuoyxprimr", model.grandparentResourceId()); + Assertions.assertEquals("teecjmeislst", model.approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, model.approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-17T18:13:46Z"), model.approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("guufuzboyjathwtz", model.ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-15T12:49:43Z"), model.createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-25T10:05:56Z"), model.stateChangedAt()); + Assertions.assertEquals("mwmdxmebwjscjpa", model.requestMetadata().resourceAction()); + Assertions.assertEquals("xveabf", model.requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("nmwmqtibx", model.requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.PENDING, model.requestMetadata().approvalStatus()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalPropertiesTests.java new file mode 100644 index 000000000000..8264c0d419f8 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalPropertiesTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalProperties; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.Approver; +import com.azure.resourcemanager.virtualenclaves.models.RequestMetadata; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApprovalPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApprovalProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Succeeded\",\"parentResourceId\":\"hcans\",\"grandparentResourceId\":\"oyqhlwig\",\"approvers\":[{\"approverEntraId\":\"bkbxgomfa\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-03-28T18:59:20Z\"},{\"approverEntraId\":\"sqvdaeyygux\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-07-22T12:02:25Z\"},{\"approverEntraId\":\"qzhzbezkgimsi\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-07-05T18:23:30Z\"}],\"ticketId\":\"cddyvvjsk\",\"createdAt\":\"2021-05-01T19:54:35Z\",\"stateChangedAt\":\"2021-06-30T14:43:36Z\",\"requestMetadata\":{\"resourceAction\":\"wa\",\"approvalCallbackRoute\":\"qgatjeaahhvjhhn\",\"approvalCallbackPayload\":\"zybbj\",\"approvalStatus\":\"Deleted\"}}") + .toObject(ApprovalProperties.class); + Assertions.assertEquals("hcans", model.parentResourceId()); + Assertions.assertEquals("oyqhlwig", model.grandparentResourceId()); + Assertions.assertEquals("bkbxgomfa", model.approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, model.approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-28T18:59:20Z"), model.approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("cddyvvjsk", model.ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-01T19:54:35Z"), model.createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-30T14:43:36Z"), model.stateChangedAt()); + Assertions.assertEquals("wa", model.requestMetadata().resourceAction()); + Assertions.assertEquals("qgatjeaahhvjhhn", model.requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("zybbj", model.requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.DELETED, model.requestMetadata().approvalStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApprovalProperties model = new ApprovalProperties().withParentResourceId("hcans") + .withGrandparentResourceId("oyqhlwig") + .withApprovers(Arrays.asList( + new Approver().withApproverEntraId("bkbxgomfa") + .withActionPerformed(ActionPerformed.REJECTED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-03-28T18:59:20Z")), + new Approver().withApproverEntraId("sqvdaeyygux") + .withActionPerformed(ActionPerformed.REJECTED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-07-22T12:02:25Z")), + new Approver().withApproverEntraId("qzhzbezkgimsi") + .withActionPerformed(ActionPerformed.APPROVED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-07-05T18:23:30Z")))) + .withTicketId("cddyvvjsk") + .withCreatedAt(OffsetDateTime.parse("2021-05-01T19:54:35Z")) + .withStateChangedAt(OffsetDateTime.parse("2021-06-30T14:43:36Z")) + .withRequestMetadata(new RequestMetadata().withResourceAction("wa") + .withApprovalCallbackRoute("qgatjeaahhvjhhn") + .withApprovalCallbackPayload("zybbj") + .withApprovalStatus(ApprovalStatus.DELETED)); + model = BinaryData.fromObject(model).toObject(ApprovalProperties.class); + Assertions.assertEquals("hcans", model.parentResourceId()); + Assertions.assertEquals("oyqhlwig", model.grandparentResourceId()); + Assertions.assertEquals("bkbxgomfa", model.approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, model.approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-28T18:59:20Z"), model.approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("cddyvvjsk", model.ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-01T19:54:35Z"), model.createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-30T14:43:36Z"), model.stateChangedAt()); + Assertions.assertEquals("wa", model.requestMetadata().resourceAction()); + Assertions.assertEquals("qgatjeaahhvjhhn", model.requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("zybbj", model.requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.DELETED, model.requestMetadata().approvalStatus()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalResourceInnerTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalResourceInnerTests.java new file mode 100644 index 000000000000..dace2c266a2b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalResourceInnerTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.fluent.models.ApprovalResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalProperties; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.Approver; +import com.azure.resourcemanager.virtualenclaves.models.RequestMetadata; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApprovalResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApprovalResourceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"NotSpecified\",\"parentResourceId\":\"vi\",\"grandparentResourceId\":\"uwivkxoy\",\"approvers\":[{\"approverEntraId\":\"bixxrt\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-07-09T17:32:45Z\"},{\"approverEntraId\":\"pwpgclrci\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-01-12T06:52:04Z\"}],\"ticketId\":\"frkenxpmyyefrp\",\"createdAt\":\"2021-07-24T22:23:07Z\",\"stateChangedAt\":\"2021-06-23T06:19:31Z\",\"requestMetadata\":{\"resourceAction\":\"qskaw\",\"approvalCallbackRoute\":\"qvmmbn\",\"approvalCallbackPayload\":\"fr\",\"approvalStatus\":\"Approved\"}},\"id\":\"zmegnitgvk\",\"name\":\"lzyqd\",\"type\":\"fegcea\"}") + .toObject(ApprovalResourceInner.class); + Assertions.assertEquals("vi", model.properties().parentResourceId()); + Assertions.assertEquals("uwivkxoy", model.properties().grandparentResourceId()); + Assertions.assertEquals("bixxrt", model.properties().approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, model.properties().approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-09T17:32:45Z"), + model.properties().approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("frkenxpmyyefrp", model.properties().ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-24T22:23:07Z"), model.properties().createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-23T06:19:31Z"), model.properties().stateChangedAt()); + Assertions.assertEquals("qskaw", model.properties().requestMetadata().resourceAction()); + Assertions.assertEquals("qvmmbn", model.properties().requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("fr", model.properties().requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.APPROVED, model.properties().requestMetadata().approvalStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApprovalResourceInner model + = new ApprovalResourceInner().withProperties(new ApprovalProperties().withParentResourceId("vi") + .withGrandparentResourceId("uwivkxoy") + .withApprovers(Arrays.asList( + new Approver().withApproverEntraId("bixxrt") + .withActionPerformed(ActionPerformed.REJECTED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-07-09T17:32:45Z")), + new Approver().withApproverEntraId("pwpgclrci") + .withActionPerformed(ActionPerformed.APPROVED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-01-12T06:52:04Z")))) + .withTicketId("frkenxpmyyefrp") + .withCreatedAt(OffsetDateTime.parse("2021-07-24T22:23:07Z")) + .withStateChangedAt(OffsetDateTime.parse("2021-06-23T06:19:31Z")) + .withRequestMetadata(new RequestMetadata().withResourceAction("qskaw") + .withApprovalCallbackRoute("qvmmbn") + .withApprovalCallbackPayload("fr") + .withApprovalStatus(ApprovalStatus.APPROVED))); + model = BinaryData.fromObject(model).toObject(ApprovalResourceInner.class); + Assertions.assertEquals("vi", model.properties().parentResourceId()); + Assertions.assertEquals("uwivkxoy", model.properties().grandparentResourceId()); + Assertions.assertEquals("bixxrt", model.properties().approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, model.properties().approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-09T17:32:45Z"), + model.properties().approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("frkenxpmyyefrp", model.properties().ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-24T22:23:07Z"), model.properties().createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-23T06:19:31Z"), model.properties().stateChangedAt()); + Assertions.assertEquals("qskaw", model.properties().requestMetadata().resourceAction()); + Assertions.assertEquals("qvmmbn", model.properties().requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("fr", model.properties().requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.APPROVED, model.properties().requestMetadata().approvalStatus()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalResourceListResultTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalResourceListResultTests.java new file mode 100644 index 000000000000..1d5a42e639e3 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalResourceListResultTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.implementation.models.ApprovalResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class ApprovalResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApprovalResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Deleting\",\"parentResourceId\":\"gwklnsr\",\"grandparentResourceId\":\"feycxcktp\",\"approvers\":[{\"approverEntraId\":\"erteeammxqiekk\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-12-09T03:06:09Z\"},{\"approverEntraId\":\"rtkgdojbmxvavref\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-07-20T03:47:36Z\"},{\"approverEntraId\":\"vecuijpx\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-07-08T16:57:24Z\"},{\"approverEntraId\":\"wprtu\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-10-31T12:27:52Z\"}],\"ticketId\":\"ddjib\",\"createdAt\":\"2021-04-16T23:10:03Z\",\"stateChangedAt\":\"2021-03-17T04:25:55Z\",\"requestMetadata\":{\"resourceAction\":\"titvtzeexavox\",\"approvalCallbackRoute\":\"glecdmdqbwpypq\",\"approvalCallbackPayload\":\"sfj\",\"approvalStatus\":\"Pending\"}},\"id\":\"lhhxudbxvodhtnsi\",\"name\":\"ud\",\"type\":\"z\"},{\"properties\":{\"provisioningState\":\"Deleting\",\"parentResourceId\":\"kdlpa\",\"grandparentResourceId\":\"rcxfailcfxwmdb\",\"approvers\":[{\"approverEntraId\":\"fgsftufqob\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-06-10T09:16:23Z\"},{\"approverEntraId\":\"acgcckknhx\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-03-12T19:47:17Z\"},{\"approverEntraId\":\"ytnrzvuljraae\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-10-31T19:51:57Z\"},{\"approverEntraId\":\"kqg\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-01-19T04:07:18Z\"}],\"ticketId\":\"nvbroylaxx\",\"createdAt\":\"2021-03-05T01:19:37Z\",\"stateChangedAt\":\"2021-04-08T11:51:17Z\",\"requestMetadata\":{\"resourceAction\":\"sdosfjbjsvgjr\",\"approvalCallbackRoute\":\"r\",\"approvalCallbackPayload\":\"ycy\",\"approvalStatus\":\"Deleted\"}},\"id\":\"xgccknfnw\",\"name\":\"btmvpdvjdhttza\",\"type\":\"fedxihchrphkm\"}],\"nextLink\":\"jdqnsdfzpbgt\"}") + .toObject(ApprovalResourceListResult.class); + Assertions.assertEquals("gwklnsr", model.value().get(0).properties().parentResourceId()); + Assertions.assertEquals("feycxcktp", model.value().get(0).properties().grandparentResourceId()); + Assertions.assertEquals("erteeammxqiekk", + model.value().get(0).properties().approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, + model.value().get(0).properties().approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-12-09T03:06:09Z"), + model.value().get(0).properties().approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("ddjib", model.value().get(0).properties().ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-16T23:10:03Z"), + model.value().get(0).properties().createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-17T04:25:55Z"), + model.value().get(0).properties().stateChangedAt()); + Assertions.assertEquals("titvtzeexavox", model.value().get(0).properties().requestMetadata().resourceAction()); + Assertions.assertEquals("glecdmdqbwpypq", + model.value().get(0).properties().requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("sfj", model.value().get(0).properties().requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.PENDING, + model.value().get(0).properties().requestMetadata().approvalStatus()); + Assertions.assertEquals("jdqnsdfzpbgt", model.nextLink()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalSettingsPatchPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalSettingsPatchPropertiesTests.java new file mode 100644 index 000000000000..be7259826a18 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalSettingsPatchPropertiesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalSettingsPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApprovalSettingsPatchPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApprovalSettingsPatchProperties model = BinaryData.fromString( + "{\"mandatoryApprovers\":[{\"approverEntraId\":\"t\"},{\"approverEntraId\":\"udutnco\"},{\"approverEntraId\":\"mr\"},{\"approverEntraId\":\"xqtvcofu\"}]}") + .toObject(ApprovalSettingsPatchProperties.class); + Assertions.assertEquals("t", model.mandatoryApprovers().get(0).approverEntraId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApprovalSettingsPatchProperties model = new ApprovalSettingsPatchProperties() + .withMandatoryApprovers(Arrays.asList(new MandatoryApprover().withApproverEntraId("t"), + new MandatoryApprover().withApproverEntraId("udutnco"), + new MandatoryApprover().withApproverEntraId("mr"), + new MandatoryApprover().withApproverEntraId("xqtvcofu"))); + model = BinaryData.fromObject(model).toObject(ApprovalSettingsPatchProperties.class); + Assertions.assertEquals("t", model.mandatoryApprovers().get(0).approverEntraId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalSettingsTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalSettingsTests.java new file mode 100644 index 000000000000..5088b57054e7 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalSettingsTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalSettings; +import com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ApprovalSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ApprovalSettings model = BinaryData.fromString( + "{\"endpointCreation\":\"NotRequired\",\"endpointUpdate\":\"NotRequired\",\"endpointDeletion\":\"NotRequired\",\"connectionCreation\":\"Required\",\"connectionUpdate\":\"NotRequired\",\"connectionDeletion\":\"Required\",\"enclaveCreation\":\"Required\",\"enclaveDeletion\":\"Required\",\"maintenanceMode\":\"NotRequired\",\"serviceCatalogDeployment\":\"Required\",\"notificationOnApprovalCreation\":\"NotRequired\",\"notificationOnApprovalAction\":\"Required\",\"notificationOnApprovalDeletion\":\"NotRequired\",\"mandatoryApprovers\":[{\"approverEntraId\":\"afnn\"},{\"approverEntraId\":\"lpichk\"},{\"approverEntraId\":\"ymkcdyhb\"},{\"approverEntraId\":\"kkpwdreqnovvq\"}],\"minimumApproversRequired\":8526417198675254199}") + .toObject(ApprovalSettings.class); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.endpointCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.endpointUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.endpointDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.connectionCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.connectionUpdate()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.connectionDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.enclaveCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.enclaveDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.maintenanceMode()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.serviceCatalogDeployment()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.notificationOnApprovalCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.notificationOnApprovalAction()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.notificationOnApprovalDeletion()); + Assertions.assertEquals("afnn", model.mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(8526417198675254199L, model.minimumApproversRequired()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ApprovalSettings model = new ApprovalSettings().withEndpointCreation(ApprovalPolicy.NOT_REQUIRED) + .withEndpointUpdate(ApprovalPolicy.NOT_REQUIRED) + .withEndpointDeletion(ApprovalPolicy.NOT_REQUIRED) + .withConnectionCreation(ApprovalPolicy.REQUIRED) + .withConnectionUpdate(ApprovalPolicy.NOT_REQUIRED) + .withConnectionDeletion(ApprovalPolicy.REQUIRED) + .withEnclaveCreation(ApprovalPolicy.REQUIRED) + .withEnclaveDeletion(ApprovalPolicy.REQUIRED) + .withMaintenanceMode(ApprovalPolicy.NOT_REQUIRED) + .withServiceCatalogDeployment(ApprovalPolicy.REQUIRED) + .withNotificationOnApprovalCreation(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalAction(ApprovalPolicy.REQUIRED) + .withNotificationOnApprovalDeletion(ApprovalPolicy.NOT_REQUIRED) + .withMandatoryApprovers(Arrays.asList(new MandatoryApprover().withApproverEntraId("afnn"), + new MandatoryApprover().withApproverEntraId("lpichk"), + new MandatoryApprover().withApproverEntraId("ymkcdyhb"), + new MandatoryApprover().withApproverEntraId("kkpwdreqnovvq"))) + .withMinimumApproversRequired(8526417198675254199L); + model = BinaryData.fromObject(model).toObject(ApprovalSettings.class); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.endpointCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.endpointUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.endpointDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.connectionCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.connectionUpdate()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.connectionDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.enclaveCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.enclaveDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.maintenanceMode()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.serviceCatalogDeployment()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.notificationOnApprovalCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.notificationOnApprovalAction()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.notificationOnApprovalDeletion()); + Assertions.assertEquals("afnn", model.mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(8526417198675254199L, model.minimumApproversRequired()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsCreateOrUpdateMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..8bed76ede57b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsCreateOrUpdateMockTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalProperties; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalResource; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.Approver; +import com.azure.resourcemanager.virtualenclaves.models.RequestMetadata; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ApprovalsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"parentResourceId\":\"ejdoqeykg\",\"grandparentResourceId\":\"yg\",\"approvers\":[{\"approverEntraId\":\"fgqka\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-11-01T21:18:59Z\"},{\"approverEntraId\":\"xtlgflwfg\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-02-15T16:06:18Z\"},{\"approverEntraId\":\"ci\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-01-09T07:32:44Z\"},{\"approverEntraId\":\"atlijjjr\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-11-25T12:06:38Z\"}],\"ticketId\":\"a\",\"createdAt\":\"2021-05-04T16:44:59Z\",\"stateChangedAt\":\"2021-01-27T10:11:39Z\",\"requestMetadata\":{\"resourceAction\":\"kvccxetyvkunmig\",\"approvalCallbackRoute\":\"hi\",\"approvalCallbackPayload\":\"gqogjwpindedva\",\"approvalStatus\":\"Approved\"}},\"id\":\"hmedeilbjywfcfxz\",\"name\":\"rzzihvwypus\",\"type\":\"vjslczwcii\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ApprovalResource response = manager.approvals() + .define("xwmzwdfkbnrz") + .withExistingResourceUri("afjrqpjiyrqjcrg") + .withProperties(new ApprovalProperties().withParentResourceId("tbqctqjfgx") + .withGrandparentResourceId("aetgzdgvpyigd") + .withApprovers(Arrays.asList( + new Approver().withApproverEntraId("ilzdcduwj") + .withActionPerformed(ActionPerformed.REJECTED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-02-24T04:50:53Z")), + new Approver().withApproverEntraId("gucaif") + .withActionPerformed(ActionPerformed.REJECTED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-11-02T00:32:54Z")))) + .withTicketId("wgilfjqqac") + .withCreatedAt(OffsetDateTime.parse("2021-05-30T22:07:48Z")) + .withStateChangedAt(OffsetDateTime.parse("2021-09-28T16:45:06Z")) + .withRequestMetadata(new RequestMetadata().withResourceAction("dcvjwc") + .withApprovalCallbackRoute("iakeciqc") + .withApprovalCallbackPayload("rtui") + .withApprovalStatus(ApprovalStatus.APPROVED))) + .create(); + + Assertions.assertEquals("ejdoqeykg", response.properties().parentResourceId()); + Assertions.assertEquals("yg", response.properties().grandparentResourceId()); + Assertions.assertEquals("fgqka", response.properties().approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, response.properties().approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-01T21:18:59Z"), + response.properties().approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("a", response.properties().ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-04T16:44:59Z"), response.properties().createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-27T10:11:39Z"), response.properties().stateChangedAt()); + Assertions.assertEquals("kvccxetyvkunmig", response.properties().requestMetadata().resourceAction()); + Assertions.assertEquals("hi", response.properties().requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("gqogjwpindedva", response.properties().requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.APPROVED, response.properties().requestMetadata().approvalStatus()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsGetWithResponseMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsGetWithResponseMockTests.java new file mode 100644 index 000000000000..0071c9e5ac10 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsGetWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalResource; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ApprovalsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"NotSpecified\",\"parentResourceId\":\"h\",\"grandparentResourceId\":\"e\",\"approvers\":[{\"approverEntraId\":\"ukaobrlbpgsnbag\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-10-01T12:01:51Z\"},{\"approverEntraId\":\"hg\",\"actionPerformed\":\"Approved\",\"lastUpdatedAt\":\"2021-06-14T23:57:58Z\"},{\"approverEntraId\":\"wakywalhjymxcgq\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-04-13T17:52:46Z\"},{\"approverEntraId\":\"rclsso\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-08-03T00:39:12Z\"}],\"ticketId\":\"vtfycnlbvgjcodk\",\"createdAt\":\"2021-09-14T01:02:16Z\",\"stateChangedAt\":\"2021-02-25T20:23:50Z\",\"requestMetadata\":{\"resourceAction\":\"ytssikiz\",\"approvalCallbackRoute\":\"ufqbvntnr\",\"approvalCallbackPayload\":\"qsorh\",\"approvalStatus\":\"Rejected\"}},\"id\":\"gnlykm\",\"name\":\"cpwzv\",\"type\":\"doksqdtiwlwxlbon\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ApprovalResource response + = manager.approvals().getWithResponse("dbckyo", "kxkxhnegk", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("h", response.properties().parentResourceId()); + Assertions.assertEquals("e", response.properties().grandparentResourceId()); + Assertions.assertEquals("ukaobrlbpgsnbag", response.properties().approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.APPROVED, response.properties().approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-01T12:01:51Z"), + response.properties().approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("vtfycnlbvgjcodk", response.properties().ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-14T01:02:16Z"), response.properties().createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-25T20:23:50Z"), response.properties().stateChangedAt()); + Assertions.assertEquals("ytssikiz", response.properties().requestMetadata().resourceAction()); + Assertions.assertEquals("ufqbvntnr", response.properties().requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("qsorh", response.properties().requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.REJECTED, response.properties().requestMetadata().approvalStatus()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsListByParentMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsListByParentMockTests.java new file mode 100644 index 000000000000..5c407f8fb409 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsListByParentMockTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalResource; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ApprovalsListByParentMockTests { + @Test + public void testListByParent() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Running\",\"parentResourceId\":\"chygtvxbyjane\",\"grandparentResourceId\":\"bdpkxyqvgx\",\"approvers\":[{\"approverEntraId\":\"detv\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-04-16T12:52:04Z\"}],\"ticketId\":\"xuwsai\",\"createdAt\":\"2021-06-06T00:47:44Z\",\"stateChangedAt\":\"2021-06-25T20:38Z\",\"requestMetadata\":{\"resourceAction\":\"osbz\",\"approvalCallbackRoute\":\"hg\",\"approvalCallbackPayload\":\"kb\",\"approvalStatus\":\"Rejected\"}},\"id\":\"olg\",\"name\":\"y\",\"type\":\"xpvelszerqzevxo\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.approvals().listByParent("qba", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("chygtvxbyjane", response.iterator().next().properties().parentResourceId()); + Assertions.assertEquals("bdpkxyqvgx", response.iterator().next().properties().grandparentResourceId()); + Assertions.assertEquals("detv", response.iterator().next().properties().approvers().get(0).approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, + response.iterator().next().properties().approvers().get(0).actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-16T12:52:04Z"), + response.iterator().next().properties().approvers().get(0).lastUpdatedAt()); + Assertions.assertEquals("xuwsai", response.iterator().next().properties().ticketId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-06T00:47:44Z"), + response.iterator().next().properties().createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-25T20:38Z"), + response.iterator().next().properties().stateChangedAt()); + Assertions.assertEquals("osbz", response.iterator().next().properties().requestMetadata().resourceAction()); + Assertions.assertEquals("hg", + response.iterator().next().properties().requestMetadata().approvalCallbackRoute()); + Assertions.assertEquals("kb", + response.iterator().next().properties().requestMetadata().approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.REJECTED, + response.iterator().next().properties().requestMetadata().approvalStatus()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsNotifyInitiatorMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsNotifyInitiatorMockTests.java new file mode 100644 index 000000000000..189be4b3103d --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApprovalsNotifyInitiatorMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ApprovalsNotifyInitiatorMockTests { + @Test + public void testNotifyInitiator() throws Exception { + String responseStr = "{\"message\":\"yqbhd\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ApprovalActionResponse response = manager.approvals() + .notifyInitiator("eintxwaljglzobl", "waafrqulh", + new ApprovalActionRequest().withApprovalStatus(ApprovalActionRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("yqbhd", response.message()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApproverTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApproverTests.java new file mode 100644 index 000000000000..7890eca1a2b1 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ApproverTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ActionPerformed; +import com.azure.resourcemanager.virtualenclaves.models.Approver; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class ApproverTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Approver model = BinaryData.fromString( + "{\"approverEntraId\":\"jks\",\"actionPerformed\":\"Rejected\",\"lastUpdatedAt\":\"2021-04-16T16:08:50Z\"}") + .toObject(Approver.class); + Assertions.assertEquals("jks", model.approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, model.actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-16T16:08:50Z"), model.lastUpdatedAt()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Approver model = new Approver().withApproverEntraId("jks") + .withActionPerformed(ActionPerformed.REJECTED) + .withLastUpdatedAt(OffsetDateTime.parse("2021-04-16T16:08:50Z")); + model = BinaryData.fromObject(model).toObject(Approver.class); + Assertions.assertEquals("jks", model.approverEntraId()); + Assertions.assertEquals(ActionPerformed.REJECTED, model.actionPerformed()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-16T16:08:50Z"), model.lastUpdatedAt()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CheckAddressSpaceAvailabilityRequestTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CheckAddressSpaceAvailabilityRequestTests.java new file mode 100644 index 000000000000..00d1fe272f6b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CheckAddressSpaceAvailabilityRequestTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CheckAddressSpaceAvailabilityRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckAddressSpaceAvailabilityRequest model = BinaryData.fromString( + "{\"communityResourceId\":\"ai\",\"enclaveVirtualNetwork\":{\"networkName\":\"brgz\",\"networkSize\":\"msweypqwdxggicc\",\"customCidrRange\":\"xqhuexm\",\"subnetConfigurations\":[{\"subnetName\":\"lstvlzywe\",\"subnetResourceId\":\"zrncsdt\",\"networkPrefixSize\":1108362585,\"subnetDelegation\":\"siypbs\",\"addressPrefix\":\"ytguslf\",\"networkSecurityGroupResourceId\":\"dcygqukyhejhz\"},{\"subnetName\":\"sx\",\"subnetResourceId\":\"pelol\",\"networkPrefixSize\":517582343,\"subnetDelegation\":\"ksrpqv\",\"addressPrefix\":\"zraehtwd\",\"networkSecurityGroupResourceId\":\"ftswibyrcdlbhsh\"},{\"subnetName\":\"wpracstwitykhev\",\"subnetResourceId\":\"cedcpnmdy\",\"networkPrefixSize\":1994704768,\"subnetDelegation\":\"wzxltjc\",\"addressPrefix\":\"hlt\",\"networkSecurityGroupResourceId\":\"gcxn\"}],\"allowSubnetCommunication\":true}}") + .toObject(CheckAddressSpaceAvailabilityRequest.class); + Assertions.assertEquals("ai", model.communityResourceId()); + Assertions.assertEquals("brgz", model.enclaveVirtualNetwork().networkName()); + Assertions.assertEquals("msweypqwdxggicc", model.enclaveVirtualNetwork().networkSize()); + Assertions.assertEquals("xqhuexm", model.enclaveVirtualNetwork().customCidrRange()); + Assertions.assertEquals("lstvlzywe", model.enclaveVirtualNetwork().subnetConfigurations().get(0).subnetName()); + Assertions.assertEquals(1108362585, + model.enclaveVirtualNetwork().subnetConfigurations().get(0).networkPrefixSize()); + Assertions.assertEquals("siypbs", + model.enclaveVirtualNetwork().subnetConfigurations().get(0).subnetDelegation()); + Assertions.assertTrue(model.enclaveVirtualNetwork().allowSubnetCommunication()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CheckAddressSpaceAvailabilityRequest model + = new CheckAddressSpaceAvailabilityRequest().withCommunityResourceId("ai") + .withEnclaveVirtualNetwork(new EnclaveVirtualNetworkModel().withNetworkName("brgz") + .withNetworkSize("msweypqwdxggicc") + .withCustomCidrRange("xqhuexm") + .withSubnetConfigurations(Arrays.asList( + new SubnetConfiguration().withSubnetName("lstvlzywe") + .withNetworkPrefixSize(1108362585) + .withSubnetDelegation("siypbs"), + new SubnetConfiguration().withSubnetName("sx") + .withNetworkPrefixSize(517582343) + .withSubnetDelegation("ksrpqv"), + new SubnetConfiguration().withSubnetName("wpracstwitykhev") + .withNetworkPrefixSize(1994704768) + .withSubnetDelegation("wzxltjc"))) + .withAllowSubnetCommunication(true)); + model = BinaryData.fromObject(model).toObject(CheckAddressSpaceAvailabilityRequest.class); + Assertions.assertEquals("ai", model.communityResourceId()); + Assertions.assertEquals("brgz", model.enclaveVirtualNetwork().networkName()); + Assertions.assertEquals("msweypqwdxggicc", model.enclaveVirtualNetwork().networkSize()); + Assertions.assertEquals("xqhuexm", model.enclaveVirtualNetwork().customCidrRange()); + Assertions.assertEquals("lstvlzywe", model.enclaveVirtualNetwork().subnetConfigurations().get(0).subnetName()); + Assertions.assertEquals(1108362585, + model.enclaveVirtualNetwork().subnetConfigurations().get(0).networkPrefixSize()); + Assertions.assertEquals("siypbs", + model.enclaveVirtualNetwork().subnetConfigurations().get(0).subnetDelegation()); + Assertions.assertTrue(model.enclaveVirtualNetwork().allowSubnetCommunication()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CheckAddressSpaceAvailabilityResponseInnerTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CheckAddressSpaceAvailabilityResponseInnerTests.java new file mode 100644 index 000000000000..398089737598 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CheckAddressSpaceAvailabilityResponseInnerTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CheckAddressSpaceAvailabilityResponseInner; +import org.junit.jupiter.api.Assertions; + +public final class CheckAddressSpaceAvailabilityResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckAddressSpaceAvailabilityResponseInner model + = BinaryData.fromString("{\"value\":false}").toObject(CheckAddressSpaceAvailabilityResponseInner.class); + Assertions.assertFalse(model.value()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesCheckAddressSpaceAvailabilityWithResponseMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesCheckAddressSpaceAvailabilityWithResponseMockTests.java new file mode 100644 index 000000000000..4b5878be6330 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesCheckAddressSpaceAvailabilityWithResponseMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.virtualenclaves.models.CheckAddressSpaceAvailabilityResponse; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CommunitiesCheckAddressSpaceAvailabilityWithResponseMockTests { + @Test + public void testCheckAddressSpaceAvailabilityWithResponse() throws Exception { + String responseStr = "{\"value\":true}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CheckAddressSpaceAvailabilityResponse response = manager.communities() + .checkAddressSpaceAvailabilityWithResponse("plkeuachtomflryt", "wfpfmdgycx", + new CheckAddressSpaceAvailabilityRequest().withCommunityResourceId("mskwhqjjysl") + .withEnclaveVirtualNetwork(new EnclaveVirtualNetworkModel().withNetworkName("lpshhkvpedwqslsr") + .withNetworkSize("pq") + .withCustomCidrRange("wskondcbrwimuvqe") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withSubnetName("ovyrrleaesinu") + .withNetworkPrefixSize(1688205844) + .withSubnetDelegation("brjbbmpxdlvy"))) + .withAllowSubnetCommunication(false)), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertTrue(response.value()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesCreateOrUpdateMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..87dffb480af2 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesCreateOrUpdateMockTests.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalSettings; +import com.azure.resourcemanager.virtualenclaves.models.CommunityProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPropertiesPolicyOverride; +import com.azure.resourcemanager.virtualenclaves.models.CommunityResource; +import com.azure.resourcemanager.virtualenclaves.models.FirewallSKU; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CommunitiesCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"addressSpace\":\"gmsplzgaufcshhv\",\"dnsServers\":[\"gnxkympqan\",\"rjkixtw\",\"taoypnyghshxc\",\"lhkgmnsghp\"],\"provisioningState\":\"Succeeded\",\"resourceCollection\":[\"drwjjkhvyom\",\"c\"],\"managedResourceGroupName\":\"zvxnqmhrp\",\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"mkoisqcssf\"},{\"id\":\"uifmc\"},{\"id\":\"p\"},{\"id\":\"kdqzrdzsylo\"}]},\"governedServiceList\":[{\"serviceId\":\"Monitoring\",\"serviceName\":\"czzydmxzjij\",\"option\":\"ExceptionOnly\",\"enforcement\":\"Enabled\",\"policyAction\":\"Enforce\",\"initiatives\":[\"ci\"]},{\"serviceId\":\"CosmosDB\",\"serviceName\":\"efxrdcoxnbk\",\"option\":\"Deny\",\"enforcement\":\"Disabled\",\"policyAction\":\"Enforce\",\"initiatives\":[\"bnqbpizxqltgrd\",\"gypxrxvbfihwuhvc\",\"a\",\"s\"]},{\"serviceId\":\"MicrosoftSQL\",\"serviceName\":\"rblmli\",\"option\":\"ExceptionOnly\",\"enforcement\":\"Disabled\",\"policyAction\":\"None\",\"initiatives\":[\"wqagnepzwa\",\"lsbs\",\"qqqagwwrxaomzi\"]},{\"serviceId\":\"AppService\",\"serviceName\":\"rrczezkhhltnj\",\"option\":\"Allow\",\"enforcement\":\"Disabled\",\"policyAction\":\"Enforce\",\"initiatives\":[\"oyueayfbpcmsp\",\"byrrueqth\",\"mg\",\"mbscbbx\"]}],\"policyOverride\":\"None\",\"communityRoleAssignments\":[{\"roleDefinitionId\":\"iidlop\",\"principals\":[{\"id\":\"wdpyq\",\"type\":\"User\"},{\"id\":\"bxubmdna\",\"type\":\"User\"},{\"id\":\"bqwremjela\",\"type\":\"ServicePrincipal\"}]},{\"roleDefinitionId\":\"cigeleohdbvqvw\",\"principals\":[{\"id\":\"opwbeonrlkwzd\",\"type\":\"User\"},{\"id\":\"bxcea\",\"type\":\"Group\"},{\"id\":\"cptsoqfyiase\",\"type\":\"Group\"},{\"id\":\"hkrttzrazis\",\"type\":\"ServicePrincipal\"}]},{\"roleDefinitionId\":\"kiuemv\",\"principals\":[{\"id\":\"wzohm\",\"type\":\"Group\"},{\"id\":\"xxbsojklinhmd\",\"type\":\"User\"},{\"id\":\"ysprq\",\"type\":\"ServicePrincipal\"}]}],\"firewallSku\":\"Standard\",\"approvalSettings\":{\"endpointCreation\":\"Required\",\"endpointUpdate\":\"NotRequired\",\"endpointDeletion\":\"NotRequired\",\"connectionCreation\":\"Required\",\"connectionUpdate\":\"Required\",\"connectionDeletion\":\"Required\",\"enclaveCreation\":\"Required\",\"enclaveDeletion\":\"NotRequired\",\"maintenanceMode\":\"NotRequired\",\"serviceCatalogDeployment\":\"NotRequired\",\"notificationOnApprovalCreation\":\"Required\",\"notificationOnApprovalAction\":\"NotRequired\",\"notificationOnApprovalDeletion\":\"NotRequired\",\"mandatoryApprovers\":[{\"approverEntraId\":\"oucqpqojx\"},{\"approverEntraId\":\"x\"},{\"approverEntraId\":\"rzdcgdzbenribcaw\"}],\"minimumApproversRequired\":5433436523913806814},\"maintenanceModeConfiguration\":{\"mode\":\"On\",\"principals\":[{\"id\":\"wflj\",\"type\":\"User\"},{\"id\":\"namtuatmzw\",\"type\":\"Group\"},{\"id\":\"jncqtjzmi\",\"type\":\"Group\"},{\"id\":\"gbgatzuuvbxn\",\"type\":\"User\"}],\"justification\":\"Networking\"}},\"identity\":{\"principalId\":\"gahttzlswvaj\",\"tenantId\":\"utlxjoqzasunwqrj\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"ydyvkfkmro\":{\"principalId\":\"haohcmbuo\",\"clientId\":\"jrohmbpyryxameb\"},\"ucygvo\":{\"principalId\":\"nehvsmt\",\"clientId\":\"lfpya\"},\"egjlgvvpa\":{\"principalId\":\"yunssx\",\"clientId\":\"hi\"},\"ofulopmjnle\":{\"principalId\":\"ksgbuxan\",\"clientId\":\"ygdhgaqipirpiwr\"}}},\"location\":\"hcbjpibk\",\"tags\":{\"oyin\":\"uuuercta\"},\"id\":\"qpbrlc\",\"name\":\"rduczkgofxyfs\",\"type\":\"uc\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CommunityResource response = manager.communities() + .define("xfbvfb") + .withRegion("yqwcabvnuil") + .withExistingResourceGroup("ibdafhrkmdyom") + .withTags(mapOf("ugmrmf", "aswlp", "oauk", "lrxw", "moaedsxj", "fkvcisi")) + .withProperties(new CommunityProperties().withAddressSpace("i") + .withDnsServers(Arrays.asList("wpg", "deimawzov")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withServiceId(ServiceIdentifier.POSTGRE_SQL) + .withOption(GovernedServiceItemOption.DENY) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.ENFORCE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.NOT_APPLICABLE) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.AZURE_FIREWALLS) + .withOption(GovernedServiceItemOption.EXCEPTION_ONLY) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY))) + .withPolicyOverride(CommunityPropertiesPolicyOverride.NONE) + .withCommunityRoleAssignments(Arrays.asList(new RoleAssignmentItem().withRoleDefinitionId("qlhris") + .withPrincipals(Arrays.asList(new Principal().withId("miii").withType(PrincipalType.GROUP), + new Principal().withId("gqcg").withType(PrincipalType.SERVICE_PRINCIPAL))))) + .withFirewallSku(FirewallSKU.BASIC) + .withApprovalSettings(new ApprovalSettings().withEndpointCreation(ApprovalPolicy.NOT_REQUIRED) + .withEndpointUpdate(ApprovalPolicy.NOT_REQUIRED) + .withEndpointDeletion(ApprovalPolicy.NOT_REQUIRED) + .withConnectionCreation(ApprovalPolicy.REQUIRED) + .withConnectionUpdate(ApprovalPolicy.NOT_REQUIRED) + .withConnectionDeletion(ApprovalPolicy.REQUIRED) + .withEnclaveCreation(ApprovalPolicy.NOT_REQUIRED) + .withEnclaveDeletion(ApprovalPolicy.NOT_REQUIRED) + .withMaintenanceMode(ApprovalPolicy.NOT_REQUIRED) + .withServiceCatalogDeployment(ApprovalPolicy.REQUIRED) + .withNotificationOnApprovalCreation(ApprovalPolicy.REQUIRED) + .withNotificationOnApprovalAction(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalDeletion(ApprovalPolicy.NOT_REQUIRED) + .withMandatoryApprovers( + Arrays.asList(new MandatoryApprover().withApproverEntraId("lwphqlkccuzgyg"))) + .withMinimumApproversRequired(1419473330453448629L)) + .withMaintenanceModeConfiguration( + new MaintenanceModeConfigurationModel().withMode(MaintenanceModeConfigurationModelMode.ADVANCED) + .withPrincipals( + Arrays.asList(new Principal().withId("wgniipr").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("vawuwzdufypivlsb").withType(PrincipalType.USER), + new Principal().withId("pmcubkmifoxxkub").withType(PrincipalType.GROUP), + new Principal().withId("havpmhbrbqgvg").withType(PrincipalType.GROUP))) + .withJustification(MaintenanceModeConfigurationModelJustification.OFF))) + .withIdentity( + new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("ljvrcmyfqipgxhnp", new UserAssignedIdentity()))) + .create(); + + Assertions.assertEquals("hcbjpibk", response.location()); + Assertions.assertEquals("uuuercta", response.tags().get("oyin")); + Assertions.assertEquals("gmsplzgaufcshhv", response.properties().addressSpace()); + Assertions.assertEquals("gnxkympqan", response.properties().dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.MONITORING, + response.properties().governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.EXCEPTION_ONLY, + response.properties().governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.ENABLED, + response.properties().governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.ENFORCE, + response.properties().governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.NONE, response.properties().policyOverride()); + Assertions.assertEquals("iidlop", response.properties().communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("wdpyq", + response.properties().communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, + response.properties().communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.STANDARD, response.properties().firewallSku()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, response.properties().approvalSettings().endpointCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, response.properties().approvalSettings().endpointUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().endpointDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, response.properties().approvalSettings().connectionCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, response.properties().approvalSettings().connectionUpdate()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, response.properties().approvalSettings().connectionDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, response.properties().approvalSettings().enclaveCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().enclaveDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().maintenanceMode()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().serviceCatalogDeployment()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.properties().approvalSettings().notificationOnApprovalCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().notificationOnApprovalAction()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().notificationOnApprovalDeletion()); + Assertions.assertEquals("oucqpqojx", + response.properties().approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(5433436523913806814L, + response.properties().approvalSettings().minimumApproversRequired()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.ON, + response.properties().maintenanceModeConfiguration().mode()); + Assertions.assertEquals("wflj", response.properties().maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, + response.properties().maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.NETWORKING, + response.properties().maintenanceModeConfiguration().justification()); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesGetByResourceGroupWithResponseMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..6bef0108d1c6 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPropertiesPolicyOverride; +import com.azure.resourcemanager.virtualenclaves.models.CommunityResource; +import com.azure.resourcemanager.virtualenclaves.models.FirewallSKU; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CommunitiesGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"addressSpace\":\"puslvyj\",\"dnsServers\":[\"uwkasiz\",\"esfuught\",\"qfecjxeygtuhx\",\"ic\"],\"provisioningState\":\"Deleting\",\"resourceCollection\":[\"rswnjlxuzrhwp\"],\"managedResourceGroupName\":\"xjbaqehgpdohzjq\",\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"igebxncnwfepb\"}]},\"governedServiceList\":[{\"serviceId\":\"Logic\",\"serviceName\":\"xjg\",\"option\":\"Allow\",\"enforcement\":\"Disabled\",\"policyAction\":\"Enforce\",\"initiatives\":[\"gtdysnaqu\"]}],\"policyOverride\":\"Enclave\",\"communityRoleAssignments\":[{\"roleDefinitionId\":\"tqhamzjrw\",\"principals\":[{\"id\":\"zeqyjleziun\",\"type\":\"Group\"},{\"id\":\"dfzantkwcegy\",\"type\":\"Group\"},{\"id\":\"lbnseqac\",\"type\":\"ServicePrincipal\"},{\"id\":\"vpilg\",\"type\":\"ServicePrincipal\"}]},{\"roleDefinitionId\":\"oq\",\"principals\":[{\"id\":\"m\",\"type\":\"Group\"},{\"id\":\"tg\",\"type\":\"ServicePrincipal\"},{\"id\":\"iookjbsah\",\"type\":\"User\"},{\"id\":\"dt\",\"type\":\"ServicePrincipal\"}]},{\"roleDefinitionId\":\"elqacslmot\",\"principals\":[{\"id\":\"nfxofvcj\",\"type\":\"ServicePrincipal\"},{\"id\":\"dirazf\",\"type\":\"Group\"}]}],\"firewallSku\":\"Premium\",\"approvalSettings\":{\"endpointCreation\":\"NotRequired\",\"endpointUpdate\":\"NotRequired\",\"endpointDeletion\":\"Required\",\"connectionCreation\":\"NotRequired\",\"connectionUpdate\":\"Required\",\"connectionDeletion\":\"NotRequired\",\"enclaveCreation\":\"Required\",\"enclaveDeletion\":\"Required\",\"maintenanceMode\":\"NotRequired\",\"serviceCatalogDeployment\":\"NotRequired\",\"notificationOnApprovalCreation\":\"NotRequired\",\"notificationOnApprovalAction\":\"NotRequired\",\"notificationOnApprovalDeletion\":\"Required\",\"mandatoryApprovers\":[{\"approverEntraId\":\"tqsrogtuwkff\"}],\"minimumApproversRequired\":7729705463242282877},\"maintenanceModeConfiguration\":{\"mode\":\"CanNotDelete\",\"principals\":[{\"id\":\"dfvclglxnfu\",\"type\":\"ServicePrincipal\"}],\"justification\":\"Off\"}},\"identity\":{\"principalId\":\"sqo\",\"tenantId\":\"fikayiansharujtj\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"qqekewvnqvcdlgu\":{\"principalId\":\"yjqtt\",\"clientId\":\"kpqhjpenuygbq\"},\"vitac\":{\"principalId\":\"cmfdjwnlax\",\"clientId\":\"njqikcz\"}}},\"location\":\"mfcsserx\",\"tags\":{\"xypruuuy\":\"soxhlwntsjgqr\"},\"id\":\"nchrszizoyu\",\"name\":\"lyetndnbfqygg\",\"type\":\"g\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CommunityResource response = manager.communities() + .getByResourceGroupWithResponse("jxtxrdc", "tjvidt", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("mfcsserx", response.location()); + Assertions.assertEquals("soxhlwntsjgqr", response.tags().get("xypruuuy")); + Assertions.assertEquals("puslvyj", response.properties().addressSpace()); + Assertions.assertEquals("uwkasiz", response.properties().dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.LOGIC, + response.properties().governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.ALLOW, + response.properties().governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.DISABLED, + response.properties().governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.ENFORCE, + response.properties().governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.ENCLAVE, response.properties().policyOverride()); + Assertions.assertEquals("tqhamzjrw", + response.properties().communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("zeqyjleziun", + response.properties().communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.GROUP, + response.properties().communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.PREMIUM, response.properties().firewallSku()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().endpointCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, response.properties().approvalSettings().endpointUpdate()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, response.properties().approvalSettings().endpointDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().connectionCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, response.properties().approvalSettings().connectionUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().connectionDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, response.properties().approvalSettings().enclaveCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, response.properties().approvalSettings().enclaveDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().maintenanceMode()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().serviceCatalogDeployment()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().notificationOnApprovalCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.properties().approvalSettings().notificationOnApprovalAction()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.properties().approvalSettings().notificationOnApprovalDeletion()); + Assertions.assertEquals("tqsrogtuwkff", + response.properties().approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(7729705463242282877L, + response.properties().approvalSettings().minimumApproversRequired()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.CAN_NOT_DELETE, + response.properties().maintenanceModeConfiguration().mode()); + Assertions.assertEquals("dfvclglxnfu", + response.properties().maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + response.properties().maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.OFF, + response.properties().maintenanceModeConfiguration().justification()); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.identity().type()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesListByResourceGroupMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesListByResourceGroupMockTests.java new file mode 100644 index 000000000000..ff6dde44ed66 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesListByResourceGroupMockTests.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPropertiesPolicyOverride; +import com.azure.resourcemanager.virtualenclaves.models.CommunityResource; +import com.azure.resourcemanager.virtualenclaves.models.FirewallSKU; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CommunitiesListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"addressSpace\":\"wahzjmucftbyr\",\"dnsServers\":[\"ohkpigqfu\",\"u\",\"kzmkwklsnoxaxmqe\"],\"provisioningState\":\"Accepted\",\"resourceCollection\":[\"jnhgwydyyn\",\"svkhgbv\",\"ta\",\"arfdlpukhpyrnei\"],\"managedResourceGroupName\":\"cpeogkhnmgbrou\",\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"fhp\"},{\"id\":\"azjzo\"},{\"id\":\"jxhpdulontacn\"},{\"id\":\"w\"}]},\"governedServiceList\":[{\"serviceId\":\"AKS\",\"serviceName\":\"evrh\",\"option\":\"Deny\",\"enforcement\":\"Disabled\",\"policyAction\":\"None\",\"initiatives\":[\"hnsduugwbsreur\"]},{\"serviceId\":\"MicrosoftSQL\",\"serviceName\":\"fuarenlvhht\",\"option\":\"Deny\",\"enforcement\":\"Disabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"kyfede\",\"jboslcqxypok\",\"hminqcymczngnbdx\",\"ewuninvud\"]},{\"serviceId\":\"KeyVault\",\"serviceName\":\"aqdtvqecrqctmxxd\",\"option\":\"ExceptionOnly\",\"enforcement\":\"Disabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"tx\",\"vtzn\",\"pxbannovvoxc\",\"ytprwnwvroev\"]}],\"policyOverride\":\"None\",\"communityRoleAssignments\":[{\"roleDefinitionId\":\"krrro\",\"principals\":[{\"id\":\"vnsasbcrymodi\",\"type\":\"User\"}]},{\"roleDefinitionId\":\"xkl\",\"principals\":[{\"id\":\"xnazpmkml\",\"type\":\"Group\"}]},{\"roleDefinitionId\":\"evfxzopjhbzxlioh\",\"principals\":[{\"id\":\"dtfgxqbawpcbb\",\"type\":\"Group\"}]}],\"firewallSku\":\"Basic\",\"approvalSettings\":{\"endpointCreation\":\"Required\",\"endpointUpdate\":\"Required\",\"endpointDeletion\":\"Required\",\"connectionCreation\":\"NotRequired\",\"connectionUpdate\":\"Required\",\"connectionDeletion\":\"NotRequired\",\"enclaveCreation\":\"Required\",\"enclaveDeletion\":\"Required\",\"maintenanceMode\":\"Required\",\"serviceCatalogDeployment\":\"NotRequired\",\"notificationOnApprovalCreation\":\"NotRequired\",\"notificationOnApprovalAction\":\"NotRequired\",\"notificationOnApprovalDeletion\":\"Required\",\"mandatoryApprovers\":[{\"approverEntraId\":\"mhmwffpl\"}],\"minimumApproversRequired\":647940693726687760},\"maintenanceModeConfiguration\":{\"mode\":\"General\",\"principals\":[{\"id\":\"ccrrvweyoxoyyu\",\"type\":\"ServicePrincipal\"},{\"id\":\"haim\",\"type\":\"User\"},{\"id\":\"iroqbosh\",\"type\":\"ServicePrincipal\"}],\"justification\":\"Networking\"}},\"identity\":{\"principalId\":\"yyrmfsvbp\",\"tenantId\":\"bopfppdbwnup\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"hqepvufhbzehewh\":{\"principalId\":\"um\",\"clientId\":\"jcaacfdmmcpugm\"},\"krsrrmoucs\":{\"principalId\":\"hnl\",\"clientId\":\"nbldxeaclgschori\"},\"bsxtkcudfbsfarfs\":{\"principalId\":\"ldpuviy\",\"clientId\":\"aabeolhbhlvbmxuq\"}}},\"location\":\"wlkjxn\",\"tags\":{\"ksaoafcluqvox\":\"wgfstmhqykizm\"},\"id\":\"ycjimryvwgcwwpbm\",\"name\":\"gwe\",\"type\":\"ydsx\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.communities().listByResourceGroup("lnlg", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("wlkjxn", response.iterator().next().location()); + Assertions.assertEquals("wgfstmhqykizm", response.iterator().next().tags().get("ksaoafcluqvox")); + Assertions.assertEquals("wahzjmucftbyr", response.iterator().next().properties().addressSpace()); + Assertions.assertEquals("ohkpigqfu", response.iterator().next().properties().dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.AKS, + response.iterator().next().properties().governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.DENY, + response.iterator().next().properties().governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.DISABLED, + response.iterator().next().properties().governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.NONE, + response.iterator().next().properties().governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.NONE, + response.iterator().next().properties().policyOverride()); + Assertions.assertEquals("krrro", + response.iterator().next().properties().communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("vnsasbcrymodi", + response.iterator().next().properties().communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, + response.iterator().next().properties().communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.BASIC, response.iterator().next().properties().firewallSku()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().endpointCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().endpointUpdate()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().endpointDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().connectionCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().connectionUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().connectionDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().enclaveCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().enclaveDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().maintenanceMode()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().serviceCatalogDeployment()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().notificationOnApprovalCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().notificationOnApprovalAction()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().notificationOnApprovalDeletion()); + Assertions.assertEquals("mhmwffpl", + response.iterator().next().properties().approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(647940693726687760L, + response.iterator().next().properties().approvalSettings().minimumApproversRequired()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.GENERAL, + response.iterator().next().properties().maintenanceModeConfiguration().mode()); + Assertions.assertEquals("ccrrvweyoxoyyu", + response.iterator().next().properties().maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + response.iterator().next().properties().maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.NETWORKING, + response.iterator().next().properties().maintenanceModeConfiguration().justification()); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, + response.iterator().next().identity().type()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesListMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesListMockTests.java new file mode 100644 index 000000000000..87105a561c4f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunitiesListMockTests.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPropertiesPolicyOverride; +import com.azure.resourcemanager.virtualenclaves.models.CommunityResource; +import com.azure.resourcemanager.virtualenclaves.models.FirewallSKU; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CommunitiesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"addressSpace\":\"ohec\",\"dnsServers\":[\"pwndyqlea\",\"lklmtkhlo\",\"kxxpvbrd\",\"jmzsyzfh\"],\"provisioningState\":\"Running\",\"resourceCollection\":[\"k\",\"yych\"],\"managedResourceGroupName\":\"sjlpjrtwszhv\",\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"hvtrrmhwrbfdpyf\"}]},\"governedServiceList\":[{\"serviceId\":\"KeyVault\",\"serviceName\":\"jgl\",\"option\":\"NotApplicable\",\"enforcement\":\"Enabled\",\"policyAction\":\"None\",\"initiatives\":[\"hmem\",\"ooclutnp\",\"memczjkmmyk\",\"ujxsglhsr\"]},{\"serviceId\":\"KeyVault\",\"serviceName\":\"ejylmbkzu\",\"option\":\"ExceptionOnly\",\"enforcement\":\"Enabled\",\"policyAction\":\"None\",\"initiatives\":[\"tjewlpxuzzj\",\"nrefqyh\",\"otoihiqa\",\"ydiw\"]}],\"policyOverride\":\"None\",\"communityRoleAssignments\":[{\"roleDefinitionId\":\"pzdqtvhcspod\",\"principals\":[{\"id\":\"xsi\",\"type\":\"ServicePrincipal\"},{\"id\":\"etgbebjfulb\",\"type\":\"User\"},{\"id\":\"ichdlpn\",\"type\":\"User\"}]},{\"roleDefinitionId\":\"ubntnbatzviqsow\",\"principals\":[{\"id\":\"el\",\"type\":\"ServicePrincipal\"},{\"id\":\"ttcjuhplrvkmjc\",\"type\":\"User\"}]},{\"roleDefinitionId\":\"jvlgfggcvkyyliz\",\"principals\":[{\"id\":\"jpsfxsfu\",\"type\":\"ServicePrincipal\"},{\"id\":\"lvt\",\"type\":\"User\"},{\"id\":\"agb\",\"type\":\"User\"},{\"id\":\"dqlvhukoveof\",\"type\":\"User\"}]}],\"firewallSku\":\"Standard\",\"approvalSettings\":{\"endpointCreation\":\"NotRequired\",\"endpointUpdate\":\"Required\",\"endpointDeletion\":\"Required\",\"connectionCreation\":\"NotRequired\",\"connectionUpdate\":\"Required\",\"connectionDeletion\":\"Required\",\"enclaveCreation\":\"NotRequired\",\"enclaveDeletion\":\"Required\",\"maintenanceMode\":\"NotRequired\",\"serviceCatalogDeployment\":\"NotRequired\",\"notificationOnApprovalCreation\":\"NotRequired\",\"notificationOnApprovalAction\":\"NotRequired\",\"notificationOnApprovalDeletion\":\"NotRequired\",\"mandatoryApprovers\":[{\"approverEntraId\":\"uuyjucejikz\"},{\"approverEntraId\":\"eovvtzej\"},{\"approverEntraId\":\"tjklntikyjuzk\"}],\"minimumApproversRequired\":4359795110481373493},\"maintenanceModeConfiguration\":{\"mode\":\"CanNotDelete\",\"principals\":[{\"id\":\"zvhqjwtrhtgvg\",\"type\":\"Group\"}],\"justification\":\"Networking\"}},\"identity\":{\"principalId\":\"olawjmjsmwrokcdx\",\"tenantId\":\"zz\",\"type\":\"None\",\"userAssignedIdentities\":{\"sgzv\":{\"principalId\":\"itlhguyn\",\"clientId\":\"hlgmltxdwhmoz\"},\"rag\":{\"principalId\":\"snnjzfpafolpym\",\"clientId\":\"mxq\"},\"ejchcsrlz\":{\"principalId\":\"dphtv\",\"clientId\":\"lajv\"},\"nzqtpjhmqrhvt\":{\"principalId\":\"mzlanru\",\"clientId\":\"wvnph\"}}},\"location\":\"aiwdcxsmlzzhz\",\"tags\":{\"b\":\"etlgydlhqvlnnpx\",\"gjekglklby\":\"fiqgeaar\",\"hj\":\"lidwcwvmzegjon\"},\"id\":\"rwgdnqzbrfks\",\"name\":\"zhzmtksjci\",\"type\":\"digsxcdgl\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.communities().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("aiwdcxsmlzzhz", response.iterator().next().location()); + Assertions.assertEquals("etlgydlhqvlnnpx", response.iterator().next().tags().get("b")); + Assertions.assertEquals("ohec", response.iterator().next().properties().addressSpace()); + Assertions.assertEquals("pwndyqlea", response.iterator().next().properties().dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.KEY_VAULT, + response.iterator().next().properties().governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.NOT_APPLICABLE, + response.iterator().next().properties().governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.ENABLED, + response.iterator().next().properties().governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.NONE, + response.iterator().next().properties().governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.NONE, + response.iterator().next().properties().policyOverride()); + Assertions.assertEquals("pzdqtvhcspod", + response.iterator().next().properties().communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("xsi", + response.iterator().next().properties().communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + response.iterator().next().properties().communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.STANDARD, response.iterator().next().properties().firewallSku()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().endpointCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().endpointUpdate()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().endpointDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().connectionCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().connectionUpdate()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().connectionDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().enclaveCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + response.iterator().next().properties().approvalSettings().enclaveDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().maintenanceMode()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().serviceCatalogDeployment()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().notificationOnApprovalCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().notificationOnApprovalAction()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + response.iterator().next().properties().approvalSettings().notificationOnApprovalDeletion()); + Assertions.assertEquals("uuyjucejikz", + response.iterator().next().properties().approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(4359795110481373493L, + response.iterator().next().properties().approvalSettings().minimumApproversRequired()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.CAN_NOT_DELETE, + response.iterator().next().properties().maintenanceModeConfiguration().mode()); + Assertions.assertEquals("zvhqjwtrhtgvg", + response.iterator().next().properties().maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.GROUP, + response.iterator().next().properties().maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.NETWORKING, + response.iterator().next().properties().maintenanceModeConfiguration().justification()); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.iterator().next().identity().type()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointDestinationRuleTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointDestinationRuleTests.java new file mode 100644 index 000000000000..7b434a089bcb --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointDestinationRuleTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CommunityEndpointDestinationRuleTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommunityEndpointDestinationRule model = BinaryData.fromString( + "{\"destinationType\":\"PrivateNetwork\",\"protocols\":[\"UDP\",\"UDP\",\"AH\"],\"transitHubResourceId\":\"qzz\",\"endpointRuleName\":\"jvpglydzgk\",\"destination\":\"qeevt\",\"ports\":\"pryu\"}") + .toObject(CommunityEndpointDestinationRule.class); + Assertions.assertEquals(DestinationType.PRIVATE_NETWORK, model.destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.UDP, model.protocols().get(0)); + Assertions.assertEquals("qzz", model.transitHubResourceId()); + Assertions.assertEquals("jvpglydzgk", model.endpointRuleName()); + Assertions.assertEquals("qeevt", model.destination()); + Assertions.assertEquals("pryu", model.ports()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommunityEndpointDestinationRule model + = new CommunityEndpointDestinationRule().withDestinationType(DestinationType.PRIVATE_NETWORK) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.UDP, CommunityEndpointProtocol.UDP, + CommunityEndpointProtocol.AH)) + .withTransitHubResourceId("qzz") + .withEndpointRuleName("jvpglydzgk") + .withDestination("qeevt") + .withPorts("pryu"); + model = BinaryData.fromObject(model).toObject(CommunityEndpointDestinationRule.class); + Assertions.assertEquals(DestinationType.PRIVATE_NETWORK, model.destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.UDP, model.protocols().get(0)); + Assertions.assertEquals("qzz", model.transitHubResourceId()); + Assertions.assertEquals("jvpglydzgk", model.endpointRuleName()); + Assertions.assertEquals("qeevt", model.destination()); + Assertions.assertEquals("pryu", model.ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointPatchModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointPatchModelTests.java new file mode 100644 index 000000000000..fa42355a048d --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointPatchModelTests.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CommunityEndpointPatchModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommunityEndpointPatchModel model = BinaryData.fromString( + "{\"properties\":{\"ruleCollection\":[{\"destinationType\":\"PrivateNetwork\",\"protocols\":[\"ESP\",\"TCP\"],\"transitHubResourceId\":\"vzvfvaawzqadfl\",\"endpointRuleName\":\"ur\",\"destination\":\"laecxndticok\",\"ports\":\"zmlqtmldgxo\"},{\"destinationType\":\"FQDNTag\",\"protocols\":[\"ICMP\",\"TCP\"],\"transitHubResourceId\":\"kciayzri\",\"endpointRuleName\":\"hya\",\"destination\":\"vjlboxqvk\",\"ports\":\"mxho\"},{\"destinationType\":\"IPAddress\",\"protocols\":[\"ICMP\",\"HTTPS\"],\"transitHubResourceId\":\"igu\",\"endpointRuleName\":\"nraauzz\",\"destination\":\"jazysdzhezwwvaiq\",\"ports\":\"vv\"}]},\"tags\":{\"ikvylauya\":\"kphhq\"}}") + .toObject(CommunityEndpointPatchModel.class); + Assertions.assertEquals(DestinationType.PRIVATE_NETWORK, + model.properties().ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.ESP, + model.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("vzvfvaawzqadfl", model.properties().ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("ur", model.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("laecxndticok", model.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("zmlqtmldgxo", model.properties().ruleCollection().get(0).ports()); + Assertions.assertEquals("kphhq", model.tags().get("ikvylauya")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommunityEndpointPatchModel model + = new CommunityEndpointPatchModel() + .withProperties( + new CommunityEndpointPatchProperties() + .withRuleCollection(Arrays.asList( + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.PRIVATE_NETWORK) + .withProtocols( + Arrays.asList(CommunityEndpointProtocol.ESP, CommunityEndpointProtocol.TCP)) + .withTransitHubResourceId("vzvfvaawzqadfl") + .withEndpointRuleName("ur") + .withDestination("laecxndticok") + .withPorts("zmlqtmldgxo"), + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDNTAG) + .withProtocols( + Arrays.asList(CommunityEndpointProtocol.ICMP, CommunityEndpointProtocol.TCP)) + .withTransitHubResourceId("kciayzri") + .withEndpointRuleName("hya") + .withDestination("vjlboxqvk") + .withPorts("mxho"), + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.IPADDRESS) + .withProtocols( + Arrays.asList(CommunityEndpointProtocol.ICMP, CommunityEndpointProtocol.HTTPS)) + .withTransitHubResourceId("igu") + .withEndpointRuleName("nraauzz") + .withDestination("jazysdzhezwwvaiq") + .withPorts("vv")))) + .withTags(mapOf("ikvylauya", "kphhq")); + model = BinaryData.fromObject(model).toObject(CommunityEndpointPatchModel.class); + Assertions.assertEquals(DestinationType.PRIVATE_NETWORK, + model.properties().ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.ESP, + model.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("vzvfvaawzqadfl", model.properties().ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("ur", model.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("laecxndticok", model.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("zmlqtmldgxo", model.properties().ruleCollection().get(0).ports()); + Assertions.assertEquals("kphhq", model.tags().get("ikvylauya")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointPatchPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointPatchPropertiesTests.java new file mode 100644 index 000000000000..65d42c1967f4 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointPatchPropertiesTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CommunityEndpointPatchPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommunityEndpointPatchProperties model = BinaryData.fromString( + "{\"ruleCollection\":[{\"destinationType\":\"FQDN\",\"protocols\":[\"HTTP\",\"ESP\"],\"transitHubResourceId\":\"tijfybvp\",\"endpointRuleName\":\"krsgsgb\",\"destination\":\"uzqgnjdgkynsc\",\"ports\":\"qhzvhxnkomt\"},{\"destinationType\":\"FQDN\",\"protocols\":[\"ICMP\"],\"transitHubResourceId\":\"nvdxzxhihfrbbc\",\"endpointRuleName\":\"qagt\",\"destination\":\"dhlfkqojpykvgt\",\"ports\":\"cnifm\"}]}") + .toObject(CommunityEndpointPatchProperties.class); + Assertions.assertEquals(DestinationType.FQDN, model.ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.HTTP, model.ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("tijfybvp", model.ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("krsgsgb", model.ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("uzqgnjdgkynsc", model.ruleCollection().get(0).destination()); + Assertions.assertEquals("qhzvhxnkomt", model.ruleCollection().get(0).ports()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommunityEndpointPatchProperties model + = new CommunityEndpointPatchProperties() + .withRuleCollection( + Arrays + .asList( + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDN) + .withProtocols( + Arrays.asList(CommunityEndpointProtocol.HTTP, CommunityEndpointProtocol.ESP)) + .withTransitHubResourceId("tijfybvp") + .withEndpointRuleName("krsgsgb") + .withDestination("uzqgnjdgkynsc") + .withPorts("qhzvhxnkomt"), + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDN) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.ICMP)) + .withTransitHubResourceId("nvdxzxhihfrbbc") + .withEndpointRuleName("qagt") + .withDestination("dhlfkqojpykvgt") + .withPorts("cnifm"))); + model = BinaryData.fromObject(model).toObject(CommunityEndpointPatchProperties.class); + Assertions.assertEquals(DestinationType.FQDN, model.ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.HTTP, model.ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("tijfybvp", model.ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("krsgsgb", model.ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("uzqgnjdgkynsc", model.ruleCollection().get(0).destination()); + Assertions.assertEquals("qhzvhxnkomt", model.ruleCollection().get(0).ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointPropertiesTests.java new file mode 100644 index 000000000000..7f62800a37b4 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointPropertiesTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CommunityEndpointPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommunityEndpointProperties model = BinaryData.fromString( + "{\"ruleCollection\":[{\"destinationType\":\"FQDNTag\",\"protocols\":[\"ICMP\",\"AH\",\"HTTPS\"],\"transitHubResourceId\":\"widf\",\"endpointRuleName\":\"sspuunnoxyhkx\",\"destination\":\"ddrihpf\",\"ports\":\"qcaaewdaomdjvl\"},{\"destinationType\":\"FQDN\",\"protocols\":[\"ANY\",\"TCP\",\"HTTPS\",\"AH\"],\"transitHubResourceId\":\"geivsiykzkdncj\",\"endpointRuleName\":\"onbzoggculapzwy\",\"destination\":\"gogtqxepnylbf\",\"ports\":\"jlyjtlvofq\"},{\"destinationType\":\"IPAddress\",\"protocols\":[\"UDP\"],\"transitHubResourceId\":\"yfm\",\"endpointRuleName\":\"uxrkjp\",\"destination\":\"w\",\"ports\":\"zwiivwzjbhyzs\"},{\"destinationType\":\"FQDNTag\",\"protocols\":[\"AH\",\"ICMP\",\"HTTP\"],\"transitHubResourceId\":\"negvmnvuqe\",\"endpointRuleName\":\"lds\",\"destination\":\"stjbkkdmfl\",\"ports\":\"stmjlxrri\"}],\"resourceCollection\":[\"apeewchpxlkt\",\"kuziycsle\",\"ufuztcktyhjtq\"],\"provisioningState\":\"Updating\"}") + .toObject(CommunityEndpointProperties.class); + Assertions.assertEquals(DestinationType.FQDNTAG, model.ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.ICMP, model.ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("widf", model.ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("sspuunnoxyhkx", model.ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("ddrihpf", model.ruleCollection().get(0).destination()); + Assertions.assertEquals("qcaaewdaomdjvl", model.ruleCollection().get(0).ports()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommunityEndpointProperties model = new CommunityEndpointProperties().withRuleCollection(Arrays.asList( + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDNTAG) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.ICMP, CommunityEndpointProtocol.AH, + CommunityEndpointProtocol.HTTPS)) + .withTransitHubResourceId("widf") + .withEndpointRuleName("sspuunnoxyhkx") + .withDestination("ddrihpf") + .withPorts("qcaaewdaomdjvl"), + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDN) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.ANY, CommunityEndpointProtocol.TCP, + CommunityEndpointProtocol.HTTPS, CommunityEndpointProtocol.AH)) + .withTransitHubResourceId("geivsiykzkdncj") + .withEndpointRuleName("onbzoggculapzwy") + .withDestination("gogtqxepnylbf") + .withPorts("jlyjtlvofq"), + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.IPADDRESS) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.UDP)) + .withTransitHubResourceId("yfm") + .withEndpointRuleName("uxrkjp") + .withDestination("w") + .withPorts("zwiivwzjbhyzs"), + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDNTAG) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.AH, CommunityEndpointProtocol.ICMP, + CommunityEndpointProtocol.HTTP)) + .withTransitHubResourceId("negvmnvuqe") + .withEndpointRuleName("lds") + .withDestination("stjbkkdmfl") + .withPorts("stmjlxrri"))); + model = BinaryData.fromObject(model).toObject(CommunityEndpointProperties.class); + Assertions.assertEquals(DestinationType.FQDNTAG, model.ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.ICMP, model.ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("widf", model.ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("sspuunnoxyhkx", model.ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("ddrihpf", model.ruleCollection().get(0).destination()); + Assertions.assertEquals("qcaaewdaomdjvl", model.ruleCollection().get(0).ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointResourceInnerTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointResourceInnerTests.java new file mode 100644 index 000000000000..6ad7ea12cff9 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointResourceInnerTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityEndpointResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CommunityEndpointResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommunityEndpointResourceInner model = BinaryData.fromString( + "{\"properties\":{\"ruleCollection\":[{\"destinationType\":\"FQDN\",\"protocols\":[\"HTTPS\",\"ESP\",\"TCP\"],\"transitHubResourceId\":\"juewbcihxuuwhcjy\",\"endpointRuleName\":\"cybvpayakkudzpxg\",\"destination\":\"plmag\",\"ports\":\"cyohpfkyrkdbd\"}],\"resourceCollection\":[\"gsj\",\"mnwqj\",\"obaiyhddviaceg\"],\"provisioningState\":\"Succeeded\"},\"location\":\"tfpmvmemfnczdw\",\"tags\":{\"db\":\"alxlllchp\"},\"id\":\"evwrdnhfuk\",\"name\":\"vsjcswsmystuluqy\",\"type\":\"fcvlerch\"}") + .toObject(CommunityEndpointResourceInner.class); + Assertions.assertEquals("tfpmvmemfnczdw", model.location()); + Assertions.assertEquals("alxlllchp", model.tags().get("db")); + Assertions.assertEquals(DestinationType.FQDN, model.properties().ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.HTTPS, + model.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("juewbcihxuuwhcjy", model.properties().ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("cybvpayakkudzpxg", model.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("plmag", model.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("cyohpfkyrkdbd", model.properties().ruleCollection().get(0).ports()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommunityEndpointResourceInner model = new CommunityEndpointResourceInner().withLocation("tfpmvmemfnczdw") + .withTags(mapOf("db", "alxlllchp")) + .withProperties(new CommunityEndpointProperties().withRuleCollection( + Arrays.asList(new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDN) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.HTTPS, CommunityEndpointProtocol.ESP, + CommunityEndpointProtocol.TCP)) + .withTransitHubResourceId("juewbcihxuuwhcjy") + .withEndpointRuleName("cybvpayakkudzpxg") + .withDestination("plmag") + .withPorts("cyohpfkyrkdbd")))); + model = BinaryData.fromObject(model).toObject(CommunityEndpointResourceInner.class); + Assertions.assertEquals("tfpmvmemfnczdw", model.location()); + Assertions.assertEquals("alxlllchp", model.tags().get("db")); + Assertions.assertEquals(DestinationType.FQDN, model.properties().ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.HTTPS, + model.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("juewbcihxuuwhcjy", model.properties().ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("cybvpayakkudzpxg", model.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("plmag", model.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("cyohpfkyrkdbd", model.properties().ruleCollection().get(0).ports()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointResourceListResultTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointResourceListResultTests.java new file mode 100644 index 000000000000..339914308701 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointResourceListResultTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.implementation.models.CommunityEndpointResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import org.junit.jupiter.api.Assertions; + +public final class CommunityEndpointResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommunityEndpointResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"ruleCollection\":[{\"destinationType\":\"FQDN\",\"protocols\":[\"HTTP\",\"HTTPS\"],\"transitHubResourceId\":\"u\",\"endpointRuleName\":\"prafwgckhoc\",\"destination\":\"d\",\"ports\":\"fwafqrouda\"},{\"destinationType\":\"PrivateNetwork\",\"protocols\":[\"ANY\"],\"transitHubResourceId\":\"r\",\"endpointRuleName\":\"bunzozudh\",\"destination\":\"gkmoyxcdyuibhmfd\",\"ports\":\"zydvfvf\"}],\"resourceCollection\":[\"aeoisrvh\"],\"provisioningState\":\"Succeeded\"},\"location\":\"ffukiscvw\",\"tags\":{\"btgn\":\"wplefaxvxil\",\"zqlqhyc\":\"nzeyqxtjj\",\"mieknlraria\":\"vodggxdbee\"},\"id\":\"wiuagydwqf\",\"name\":\"ylyrfgiagtco\",\"type\":\"ocqwogfnzjvus\"},{\"properties\":{\"ruleCollection\":[{\"destinationType\":\"IPAddress\",\"protocols\":[\"HTTPS\",\"UDP\",\"ICMP\",\"HTTPS\"],\"transitHubResourceId\":\"sbtkadpysownbtgk\",\"endpointRuleName\":\"grjqctojcmi\",\"destination\":\"fieypefojyqdhcup\",\"ports\":\"plcwkhi\"}],\"resourceCollection\":[\"lhzdsqtzb\",\"rgnowcjhfgm\",\"ecactx\",\"wotey\"],\"provisioningState\":\"NotSpecified\"},\"location\":\"uqovekqvgqouwif\",\"tags\":{\"yivqikfxcvhrfsp\":\"j\",\"kvyklxubyjaffmm\":\"uagrttikteusqc\"},\"id\":\"bl\",\"name\":\"qcuubgqibrta\",\"type\":\"metttwgd\"},{\"properties\":{\"ruleCollection\":[{\"destinationType\":\"FQDNTag\",\"protocols\":[\"ESP\",\"TCP\"],\"transitHubResourceId\":\"oi\",\"endpointRuleName\":\"seypxiutcxapz\",\"destination\":\"rpetogebjoxsl\",\"ports\":\"nhl\"},{\"destinationType\":\"IPAddress\",\"protocols\":[\"AH\"],\"transitHubResourceId\":\"zjcjbtr\",\"endpointRuleName\":\"ehvvib\",\"destination\":\"jj\",\"ports\":\"oqbeitpkxzt\"},{\"destinationType\":\"FQDN\",\"protocols\":[\"HTTPS\"],\"transitHubResourceId\":\"tidgfcwq\",\"endpointRuleName\":\"imaq\",\"destination\":\"hemjy\",\"ports\":\"hujswtwkozzwcul\"}],\"resourceCollection\":[\"wpfaj\",\"jwltlwtjjgu\",\"talhsnvkcdmxzr\",\"oaimlnw\"],\"provisioningState\":\"Accepted\"},\"location\":\"mylweazulc\",\"tags\":{\"jhlfzswpchwahf\":\"hwwn\",\"wlyxgncxyk\":\"ousnfepgfewe\"},\"id\":\"hdjhlimmbcx\",\"name\":\"h\",\"type\":\"cporxvxcjz\"},{\"properties\":{\"ruleCollection\":[{\"destinationType\":\"IPAddress\",\"protocols\":[\"HTTPS\",\"HTTPS\",\"UDP\"],\"transitHubResourceId\":\"scjavftju\",\"endpointRuleName\":\"qaz\",\"destination\":\"tgguwpijrajcivmm\",\"ports\":\"f\"},{\"destinationType\":\"FQDNTag\",\"protocols\":[\"TCP\",\"TCP\"],\"transitHubResourceId\":\"neuvyinzqod\",\"endpointRuleName\":\"pgshoxgsgbpfgz\",\"destination\":\"tx\",\"ports\":\"flbqvgaq\"}],\"resourceCollection\":[\"a\",\"cqusr\"],\"provisioningState\":\"Running\"},\"location\":\"nwsdtutnwlduyc\",\"tags\":{\"kuqgsjjxundxgket\":\"hyrmewipmvekdx\",\"gpmuneqsxvmhfbuz\":\"zhhzjhfjmhvvmu\",\"ms\":\"yihsasbhudypohyu\"},\"id\":\"ynsqyrpfoobr\",\"name\":\"ttymsjny\",\"type\":\"qdnfwqzdz\"}],\"nextLink\":\"ilaxhn\"}") + .toObject(CommunityEndpointResourceListResult.class); + Assertions.assertEquals("ffukiscvw", model.value().get(0).location()); + Assertions.assertEquals("wplefaxvxil", model.value().get(0).tags().get("btgn")); + Assertions.assertEquals(DestinationType.FQDN, + model.value().get(0).properties().ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.HTTP, + model.value().get(0).properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("u", model.value().get(0).properties().ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("prafwgckhoc", + model.value().get(0).properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("d", model.value().get(0).properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("fwafqrouda", model.value().get(0).properties().ruleCollection().get(0).ports()); + Assertions.assertEquals("ilaxhn", model.nextLink()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsCreateOrUpdateMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..60119c906931 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsCreateOrUpdateMockTests.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointResource; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CommunityEndpointsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"ruleCollection\":[{\"destinationType\":\"IPAddress\",\"protocols\":[\"ESP\",\"ESP\"],\"transitHubResourceId\":\"vadrmm\",\"endpointRuleName\":\"uawvcmjzk\",\"destination\":\"idisczskosw\",\"ports\":\"iqazugamxzkr\"},{\"destinationType\":\"PrivateNetwork\",\"protocols\":[\"ESP\",\"ICMP\",\"ICMP\"],\"transitHubResourceId\":\"nppcce\",\"endpointRuleName\":\"ztdsbeza\",\"destination\":\"f\",\"ports\":\"zxuizhyhnepkpe\"},{\"destinationType\":\"FQDNTag\",\"protocols\":[\"HTTPS\",\"ESP\",\"HTTP\",\"HTTPS\"],\"transitHubResourceId\":\"dukecp\",\"endpointRuleName\":\"azvdhctmmkosz\",\"destination\":\"blnsntrpcaqk\",\"ports\":\"f\"}],\"resourceCollection\":[\"fmhklbnld\",\"vcb\",\"hez\",\"quwusq\"],\"provisioningState\":\"Succeeded\"},\"location\":\"pbrruyu\",\"tags\":{\"jwcolbm\":\"vlm\",\"z\":\"lbnwtpcpahp\",\"ngxno\":\"vxhmtfhocnxzcmj\",\"sn\":\"rxtd\"},\"id\":\"evhdlmydid\",\"name\":\"hepfwwtjfdoes\",\"type\":\"xhmw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CommunityEndpointResource response + = manager.communityEndpoints() + .define("jpodtbl") + .withRegion("jroumzzn") + .withExistingCommunity("ah", "hxalybxawo") + .withTags(mapOf("pusllywpv", "qjrhuzgfxonj")) + .withProperties( + new CommunityEndpointProperties() + .withRuleCollection(Arrays.asList( + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.IPADDRESS) + .withProtocols( + Arrays.asList(CommunityEndpointProtocol.AH, CommunityEndpointProtocol.UDP)) + .withTransitHubResourceId("qhykincn") + .withEndpointRuleName("mehllizhceu") + .withDestination("qodkadppyibngql") + .withPorts("ywrxw"), + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.PRIVATE_NETWORK) + .withProtocols( + Arrays.asList(CommunityEndpointProtocol.AH, CommunityEndpointProtocol.ICMP)) + .withTransitHubResourceId("adswz") + .withEndpointRuleName("uyem") + .withDestination("wuowhlxlnwy") + .withPorts("ouvblgmo"), + new CommunityEndpointDestinationRule().withDestinationType(DestinationType.FQDNTAG) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.HTTPS, + CommunityEndpointProtocol.HTTP, CommunityEndpointProtocol.HTTP)) + .withTransitHubResourceId("tdvrfmv") + .withEndpointRuleName("hcvjdrqc") + .withDestination("idhftu") + .withPorts("hdxlw")))) + .create(); + + Assertions.assertEquals("pbrruyu", response.location()); + Assertions.assertEquals("vlm", response.tags().get("jwcolbm")); + Assertions.assertEquals(DestinationType.IPADDRESS, + response.properties().ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.ESP, + response.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("vadrmm", response.properties().ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("uawvcmjzk", response.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("idisczskosw", response.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("iqazugamxzkr", response.properties().ruleCollection().get(0).ports()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsGetWithResponseMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsGetWithResponseMockTests.java new file mode 100644 index 000000000000..3ac0ab16cc1e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsGetWithResponseMockTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointResource; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CommunityEndpointsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"ruleCollection\":[{\"destinationType\":\"PrivateNetwork\",\"protocols\":[\"ICMP\",\"HTTP\",\"ANY\",\"HTTP\"],\"transitHubResourceId\":\"nqxaekqsyk\",\"endpointRuleName\":\"jtqpkevmyltjcrsp\",\"destination\":\"l\",\"ports\":\"cclfgxannn\"},{\"destinationType\":\"FQDN\",\"protocols\":[\"UDP\",\"AH\"],\"transitHubResourceId\":\"wxigpxv\",\"endpointRuleName\":\"maupxvpi\",\"destination\":\"f\",\"ports\":\"fyzyzeyuub\"},{\"destinationType\":\"FQDN\",\"protocols\":[\"ANY\",\"UDP\"],\"transitHubResourceId\":\"toi\",\"endpointRuleName\":\"gygvfltgvdiho\",\"destination\":\"krxwet\",\"ports\":\"drcyrucpcun\"}],\"resourceCollection\":[\"dqumoenodnai\",\"nhq\"],\"provisioningState\":\"Updating\"},\"location\":\"dnelqkaad\",\"tags\":{\"anniyopetxivcnr\":\"wf\"},\"id\":\"yxnu\",\"name\":\"aephblkw\",\"type\":\"pat\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CommunityEndpointResource response = manager.communityEndpoints() + .getWithResponse("rkgwltxeqip", "gzdyimsfayorp", "avkjog", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("dnelqkaad", response.location()); + Assertions.assertEquals("wf", response.tags().get("anniyopetxivcnr")); + Assertions.assertEquals(DestinationType.PRIVATE_NETWORK, + response.properties().ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.ICMP, + response.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("nqxaekqsyk", response.properties().ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("jtqpkevmyltjcrsp", response.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("l", response.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("cclfgxannn", response.properties().ruleCollection().get(0).ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalCreationMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalCreationMockTests.java new file mode 100644 index 000000000000..f525808ed642 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalCreationMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CommunityEndpointsHandleApprovalCreationMockTests { + @Test + public void testHandleApprovalCreation() throws Exception { + String responseStr = "{\"message\":\"ufanray\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ApprovalActionResponse response = manager.communityEndpoints() + .handleApprovalCreation("yxey", "uqi", "ijiitns", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.RESET) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED) + .withApprovalCallbackPayload("desygrijwa"), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("ufanray", response.message()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalDeletionMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalDeletionMockTests.java new file mode 100644 index 000000000000..6b5a57b79efd --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsHandleApprovalDeletionMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CommunityEndpointsHandleApprovalDeletionMockTests { + @Test + public void testHandleApprovalDeletion() throws Exception { + String responseStr = "{\"message\":\"vdsmaklixq\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ApprovalActionResponse response = manager.communityEndpoints() + .handleApprovalDeletion( + "fueqfrojs", "dgrhydkygywezs", "iecafygzmxi", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("vdsmaklixq", response.message()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListByCommunityResourceMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListByCommunityResourceMockTests.java new file mode 100644 index 000000000000..8f7681e4d87c --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListByCommunityResourceMockTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointResource; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CommunityEndpointsListByCommunityResourceMockTests { + @Test + public void testListByCommunityResource() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"ruleCollection\":[{\"destinationType\":\"PrivateNetwork\",\"protocols\":[\"HTTP\"],\"transitHubResourceId\":\"b\",\"endpointRuleName\":\"cdb\",\"destination\":\"fzndscxmxeatkd\",\"ports\":\"wnrdjyibqbnaom\"}],\"resourceCollection\":[\"mk\",\"hmaxljalfi\"],\"provisioningState\":\"NotSpecified\"},\"location\":\"obcancdexxqcw\",\"tags\":{\"zrltixldzyyf\":\"fgvaknokzwj\"},\"id\":\"tpq\",\"name\":\"ixymmpujivyql\",\"type\":\"juvsmbmslzoyovw\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.communityEndpoints() + .listByCommunityResource("bqsdtcjbctvi", "uzqymtuowog", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("obcancdexxqcw", response.iterator().next().location()); + Assertions.assertEquals("fgvaknokzwj", response.iterator().next().tags().get("zrltixldzyyf")); + Assertions.assertEquals(DestinationType.PRIVATE_NETWORK, + response.iterator().next().properties().ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.HTTP, + response.iterator().next().properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("b", + response.iterator().next().properties().ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("cdb", + response.iterator().next().properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("fzndscxmxeatkd", + response.iterator().next().properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("wnrdjyibqbnaom", + response.iterator().next().properties().ruleCollection().get(0).ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListBySubscriptionMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListBySubscriptionMockTests.java new file mode 100644 index 000000000000..cd1ca555ee89 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityEndpointsListBySubscriptionMockTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.CommunityEndpointResource; +import com.azure.resourcemanager.virtualenclaves.models.DestinationType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CommunityEndpointsListBySubscriptionMockTests { + @Test + public void testListBySubscription() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"ruleCollection\":[{\"destinationType\":\"IPAddress\",\"protocols\":[\"UDP\"],\"transitHubResourceId\":\"bse\",\"endpointRuleName\":\"vcuartrhun\",\"destination\":\"iryky\",\"ports\":\"dzfqivjreuy\"},{\"destinationType\":\"FQDNTag\",\"protocols\":[\"HTTP\",\"TCP\"],\"transitHubResourceId\":\"ltbxoeeonqlnfw\",\"endpointRuleName\":\"ymvqdbpbhfckdvez\",\"destination\":\"cssbzhddu\",\"ports\":\"nqfblhkalehpava\"},{\"destinationType\":\"IPAddress\",\"protocols\":[\"ANY\",\"AH\",\"HTTPS\"],\"transitHubResourceId\":\"gqgdminictteajoh\",\"endpointRuleName\":\"gspnbonhpczykm\",\"destination\":\"p\",\"ports\":\"xqcsehch\"}],\"resourceCollection\":[\"fmpqumqyjg\",\"dzulo\",\"saeuzanhsfnhsenw\"],\"provisioningState\":\"Running\"},\"location\":\"fngq\",\"tags\":{\"rkuorh\":\"idftujwjjufwbe\",\"tiq\":\"ssruqnmdvhazcvj\",\"ukvlb\":\"wbqerzwxiytxtd\"},\"id\":\"ktg\",\"name\":\"styoua\",\"type\":\"bewreswmowegmmut\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.communityEndpoints().listBySubscription("dbpqvybefgvm", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("fngq", response.iterator().next().location()); + Assertions.assertEquals("idftujwjjufwbe", response.iterator().next().tags().get("rkuorh")); + Assertions.assertEquals(DestinationType.IPADDRESS, + response.iterator().next().properties().ruleCollection().get(0).destinationType()); + Assertions.assertEquals(CommunityEndpointProtocol.UDP, + response.iterator().next().properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("bse", + response.iterator().next().properties().ruleCollection().get(0).transitHubResourceId()); + Assertions.assertEquals("vcuartrhun", + response.iterator().next().properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("iryky", response.iterator().next().properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("dzfqivjreuy", response.iterator().next().properties().ruleCollection().get(0).ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityPatchModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityPatchModelTests.java new file mode 100644 index 000000000000..7ad2ac81f323 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityPatchModelTests.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalSettingsPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPropertiesPolicyOverride; +import com.azure.resourcemanager.virtualenclaves.models.FirewallSKU; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CommunityPatchModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommunityPatchModel model = BinaryData.fromString( + "{\"properties\":{\"dnsServers\":[\"dsytgadgvr\",\"ea\",\"neqn\"],\"governedServiceList\":[{\"serviceId\":\"AKS\",\"serviceName\":\"lquuijfqkacewii\",\"option\":\"Deny\",\"enforcement\":\"Disabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"wifto\",\"qkvpuvksgplsakn\",\"n\",\"synljphuopxodl\"]},{\"serviceId\":\"Logic\",\"serviceName\":\"ntorzihleosjswsr\",\"option\":\"NotApplicable\",\"enforcement\":\"Enabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"c\",\"ckqqzqioxiysui\",\"zynkedya\"]},{\"serviceId\":\"Storage\",\"serviceName\":\"yhqmibzyhwi\",\"option\":\"ExceptionOnly\",\"enforcement\":\"Enabled\",\"policyAction\":\"Enforce\",\"initiatives\":[\"cdpu\",\"nzgmwznmabik\"]},{\"serviceId\":\"DataConnectors\",\"serviceName\":\"rgjhxb\",\"option\":\"Deny\",\"enforcement\":\"Disabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"dmtnc\",\"ok\",\"tllxdyhgsyocogj\",\"tdtbnnhadooc\"]}],\"policyOverride\":\"None\",\"communityRoleAssignments\":[{\"roleDefinitionId\":\"khnvpam\",\"principals\":[{\"id\":\"qqu\",\"type\":\"ServicePrincipal\"}]},{\"roleDefinitionId\":\"ik\",\"principals\":[{\"id\":\"gxk\",\"type\":\"User\"},{\"id\":\"la\",\"type\":\"Group\"},{\"id\":\"elwuipi\",\"type\":\"Group\"},{\"id\":\"jzkzi\",\"type\":\"ServicePrincipal\"}]},{\"roleDefinitionId\":\"vvcnayr\",\"principals\":[{\"id\":\"nxxmueedndrdv\",\"type\":\"User\"},{\"id\":\"kwqqtchealmf\",\"type\":\"ServicePrincipal\"},{\"id\":\"d\",\"type\":\"ServicePrincipal\"}]},{\"roleDefinitionId\":\"ygdvwv\",\"principals\":[{\"id\":\"ohgwxrtfudxepxg\",\"type\":\"User\"},{\"id\":\"agvrvmnpkuk\",\"type\":\"ServicePrincipal\"},{\"id\":\"i\",\"type\":\"ServicePrincipal\"}]}],\"firewallSku\":\"Premium\",\"approvalSettings\":{\"mandatoryApprovers\":[{\"approverEntraId\":\"imfnjhfjx\"}]},\"maintenanceModeConfiguration\":{\"mode\":\"Advanced\",\"principals\":[{\"id\":\"kfoqreyfkzikfj\",\"type\":\"ServicePrincipal\"},{\"id\":\"n\",\"type\":\"Group\"}],\"justification\":\"Networking\"}},\"tags\":{\"feaenwab\":\"czelpcirel\",\"oz\":\"atklddxbjhwuaa\"},\"identity\":{\"principalId\":\"ph\",\"tenantId\":\"ulpjr\",\"type\":\"None\",\"userAssignedIdentities\":{\"qumiek\":{\"principalId\":\"rvimjwosytxitcsk\",\"clientId\":\"k\"},\"db\":{\"principalId\":\"zzikhlyfjhdg\",\"clientId\":\"gebdunygaeq\"},\"dmjsjqb\":{\"principalId\":\"atpxl\",\"clientId\":\"xcyjmoadsuvarmy\"},\"n\":{\"principalId\":\"hyxxrwlycoduhpk\",\"clientId\":\"gymare\"}}}}") + .toObject(CommunityPatchModel.class); + Assertions.assertEquals("dsytgadgvr", model.properties().dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.AKS, model.properties().governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.DENY, + model.properties().governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.DISABLED, + model.properties().governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.AUDIT_ONLY, + model.properties().governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.NONE, model.properties().policyOverride()); + Assertions.assertEquals("khnvpam", model.properties().communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("qqu", model.properties().communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.properties().communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.PREMIUM, model.properties().firewallSku()); + Assertions.assertEquals("imfnjhfjx", + model.properties().approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.ADVANCED, + model.properties().maintenanceModeConfiguration().mode()); + Assertions.assertEquals("kfoqreyfkzikfj", + model.properties().maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.properties().maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.NETWORKING, + model.properties().maintenanceModeConfiguration().justification()); + Assertions.assertEquals("czelpcirel", model.tags().get("feaenwab")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommunityPatchModel model = new CommunityPatchModel() + .withProperties(new CommunityPatchProperties().withDnsServers(Arrays.asList("dsytgadgvr", "ea", "neqn")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withServiceId(ServiceIdentifier.AKS) + .withOption(GovernedServiceItemOption.DENY) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY), + new GovernedServiceItem().withServiceId(ServiceIdentifier.LOGIC) + .withOption(GovernedServiceItemOption.NOT_APPLICABLE) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY), + new GovernedServiceItem().withServiceId(ServiceIdentifier.STORAGE) + .withOption(GovernedServiceItemOption.EXCEPTION_ONLY) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.ENFORCE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.DATA_CONNECTORS) + .withOption(GovernedServiceItemOption.DENY) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY))) + .withPolicyOverride(CommunityPropertiesPolicyOverride.NONE) + .withCommunityRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("khnvpam") + .withPrincipals( + Arrays.asList(new Principal().withId("qqu").withType(PrincipalType.SERVICE_PRINCIPAL))), + new RoleAssignmentItem().withRoleDefinitionId("ik") + .withPrincipals(Arrays.asList(new Principal().withId("gxk").withType(PrincipalType.USER), + new Principal().withId("la").withType(PrincipalType.GROUP), + new Principal().withId("elwuipi").withType(PrincipalType.GROUP), + new Principal().withId("jzkzi").withType(PrincipalType.SERVICE_PRINCIPAL))), + new RoleAssignmentItem().withRoleDefinitionId("vvcnayr") + .withPrincipals( + Arrays.asList(new Principal().withId("nxxmueedndrdv").withType(PrincipalType.USER), + new Principal().withId("kwqqtchealmf").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("d").withType(PrincipalType.SERVICE_PRINCIPAL))), + new RoleAssignmentItem().withRoleDefinitionId("ygdvwv") + .withPrincipals( + Arrays.asList(new Principal().withId("ohgwxrtfudxepxg").withType(PrincipalType.USER), + new Principal().withId("agvrvmnpkuk").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("i").withType(PrincipalType.SERVICE_PRINCIPAL))))) + .withFirewallSku(FirewallSKU.PREMIUM) + .withApprovalSettings(new ApprovalSettingsPatchProperties() + .withMandatoryApprovers(Arrays.asList(new MandatoryApprover().withApproverEntraId("imfnjhfjx")))) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationPatchModel() + .withMode(MaintenanceModeConfigurationModelMode.ADVANCED) + .withPrincipals(Arrays.asList( + new Principal().withId("kfoqreyfkzikfj").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("n").withType(PrincipalType.GROUP))) + .withJustification(MaintenanceModeConfigurationModelJustification.NETWORKING))) + .withTags(mapOf("feaenwab", "czelpcirel", "oz", "atklddxbjhwuaa")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities( + mapOf("qumiek", new UserAssignedIdentity(), "db", new UserAssignedIdentity(), "dmjsjqb", + new UserAssignedIdentity(), "n", new UserAssignedIdentity()))); + model = BinaryData.fromObject(model).toObject(CommunityPatchModel.class); + Assertions.assertEquals("dsytgadgvr", model.properties().dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.AKS, model.properties().governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.DENY, + model.properties().governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.DISABLED, + model.properties().governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.AUDIT_ONLY, + model.properties().governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.NONE, model.properties().policyOverride()); + Assertions.assertEquals("khnvpam", model.properties().communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("qqu", model.properties().communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.properties().communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.PREMIUM, model.properties().firewallSku()); + Assertions.assertEquals("imfnjhfjx", + model.properties().approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.ADVANCED, + model.properties().maintenanceModeConfiguration().mode()); + Assertions.assertEquals("kfoqreyfkzikfj", + model.properties().maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.properties().maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.NETWORKING, + model.properties().maintenanceModeConfiguration().justification()); + Assertions.assertEquals("czelpcirel", model.tags().get("feaenwab")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityPatchPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityPatchPropertiesTests.java new file mode 100644 index 000000000000..7167c0a13651 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityPatchPropertiesTests.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalSettingsPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPropertiesPolicyOverride; +import com.azure.resourcemanager.virtualenclaves.models.FirewallSKU; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CommunityPatchPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommunityPatchProperties model = BinaryData.fromString( + "{\"dnsServers\":[\"qugjhkycube\",\"dgssofwqmzqal\",\"rmnjijpx\",\"cqqudf\"],\"governedServiceList\":[{\"serviceId\":\"CosmosDB\",\"serviceName\":\"aaabjyvayff\",\"option\":\"ExceptionOnly\",\"enforcement\":\"Enabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"ogs\",\"xnevfdnwn\",\"mewzsyyc\"]},{\"serviceId\":\"MicrosoftSQL\",\"serviceName\":\"soibjudpfrx\",\"option\":\"NotApplicable\",\"enforcement\":\"Disabled\",\"policyAction\":\"Enforce\",\"initiatives\":[\"dwkqbrq\",\"bpaxhexiilivpdt\"]},{\"serviceId\":\"AppService\",\"serviceName\":\"q\",\"option\":\"ExceptionOnly\",\"enforcement\":\"Disabled\",\"policyAction\":\"Enforce\",\"initiatives\":[\"zfgs\"]},{\"serviceId\":\"PrivateDNSZones\",\"serviceName\":\"fxrxxle\",\"option\":\"ExceptionOnly\",\"enforcement\":\"Enabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"wlwnwxuqlcv\"]}],\"policyOverride\":\"None\",\"communityRoleAssignments\":[{\"roleDefinitionId\":\"tdooaoj\",\"principals\":[{\"id\":\"odko\",\"type\":\"ServicePrincipal\"},{\"id\":\"bw\",\"type\":\"User\"},{\"id\":\"jhemms\",\"type\":\"ServicePrincipal\"},{\"id\":\"dkcrodt\",\"type\":\"Group\"}]},{\"roleDefinitionId\":\"nfwjlfltkacjvefk\",\"principals\":[{\"id\":\"oakggkfpag\",\"type\":\"User\"},{\"id\":\"wpu\",\"type\":\"ServicePrincipal\"}]},{\"roleDefinitionId\":\"qblylsyxkqj\",\"principals\":[{\"id\":\"ervtiagxs\",\"type\":\"ServicePrincipal\"},{\"id\":\"zuempsbzkf\",\"type\":\"Group\"}]},{\"roleDefinitionId\":\"eyvpnqicvinvkj\",\"principals\":[{\"id\":\"xrbuukzclew\",\"type\":\"Group\"},{\"id\":\"mlwpazt\",\"type\":\"User\"},{\"id\":\"ofncckwyfzqwhxxb\",\"type\":\"User\"}]}],\"firewallSku\":\"Basic\",\"approvalSettings\":{\"mandatoryApprovers\":[{\"approverEntraId\":\"eqz\"},{\"approverEntraId\":\"ppriol\"},{\"approverEntraId\":\"or\"}]},\"maintenanceModeConfiguration\":{\"mode\":\"Advanced\",\"principals\":[{\"id\":\"lmncw\",\"type\":\"ServicePrincipal\"},{\"id\":\"bqwcsdbnwdcf\",\"type\":\"User\"},{\"id\":\"cqdpfuv\",\"type\":\"Group\"},{\"id\":\"sbjjc\",\"type\":\"Group\"}],\"justification\":\"Networking\"}}") + .toObject(CommunityPatchProperties.class); + Assertions.assertEquals("qugjhkycube", model.dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.COSMOS_DB, model.governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.EXCEPTION_ONLY, model.governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.ENABLED, + model.governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.AUDIT_ONLY, + model.governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.NONE, model.policyOverride()); + Assertions.assertEquals("tdooaoj", model.communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("odko", model.communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.BASIC, model.firewallSku()); + Assertions.assertEquals("eqz", model.approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.ADVANCED, + model.maintenanceModeConfiguration().mode()); + Assertions.assertEquals("lmncw", model.maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.NETWORKING, + model.maintenanceModeConfiguration().justification()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommunityPatchProperties model = new CommunityPatchProperties() + .withDnsServers(Arrays.asList("qugjhkycube", "dgssofwqmzqal", "rmnjijpx", "cqqudf")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withServiceId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.EXCEPTION_ONLY) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY), + new GovernedServiceItem().withServiceId(ServiceIdentifier.MICROSOFT_SQL) + .withOption(GovernedServiceItemOption.NOT_APPLICABLE) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.ENFORCE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.APP_SERVICE) + .withOption(GovernedServiceItemOption.EXCEPTION_ONLY) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.ENFORCE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.EXCEPTION_ONLY) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY))) + .withPolicyOverride(CommunityPropertiesPolicyOverride.NONE) + .withCommunityRoleAssignments(Arrays.asList(new RoleAssignmentItem().withRoleDefinitionId("tdooaoj") + .withPrincipals(Arrays.asList(new Principal().withId("odko").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("bw").withType(PrincipalType.USER), + new Principal().withId("jhemms").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("dkcrodt").withType(PrincipalType.GROUP))), + new RoleAssignmentItem().withRoleDefinitionId("nfwjlfltkacjvefk") + .withPrincipals(Arrays.asList(new Principal().withId("oakggkfpag").withType(PrincipalType.USER), + new Principal().withId("wpu").withType(PrincipalType.SERVICE_PRINCIPAL))), + new RoleAssignmentItem().withRoleDefinitionId("qblylsyxkqj") + .withPrincipals( + Arrays.asList(new Principal().withId("ervtiagxs").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("zuempsbzkf").withType(PrincipalType.GROUP))), + new RoleAssignmentItem().withRoleDefinitionId("eyvpnqicvinvkj") + .withPrincipals(Arrays.asList(new Principal().withId("xrbuukzclew").withType(PrincipalType.GROUP), + new Principal().withId("mlwpazt").withType(PrincipalType.USER), + new Principal().withId("ofncckwyfzqwhxxb").withType(PrincipalType.USER))))) + .withFirewallSku(FirewallSKU.BASIC) + .withApprovalSettings(new ApprovalSettingsPatchProperties() + .withMandatoryApprovers(Arrays.asList(new MandatoryApprover().withApproverEntraId("eqz"), + new MandatoryApprover().withApproverEntraId("ppriol"), + new MandatoryApprover().withApproverEntraId("or")))) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationPatchModel() + .withMode(MaintenanceModeConfigurationModelMode.ADVANCED) + .withPrincipals(Arrays.asList(new Principal().withId("lmncw").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("bqwcsdbnwdcf").withType(PrincipalType.USER), + new Principal().withId("cqdpfuv").withType(PrincipalType.GROUP), + new Principal().withId("sbjjc").withType(PrincipalType.GROUP))) + .withJustification(MaintenanceModeConfigurationModelJustification.NETWORKING)); + model = BinaryData.fromObject(model).toObject(CommunityPatchProperties.class); + Assertions.assertEquals("qugjhkycube", model.dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.COSMOS_DB, model.governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.EXCEPTION_ONLY, model.governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.ENABLED, + model.governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.AUDIT_ONLY, + model.governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.NONE, model.policyOverride()); + Assertions.assertEquals("tdooaoj", model.communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("odko", model.communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.BASIC, model.firewallSku()); + Assertions.assertEquals("eqz", model.approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.ADVANCED, + model.maintenanceModeConfiguration().mode()); + Assertions.assertEquals("lmncw", model.maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.NETWORKING, + model.maintenanceModeConfiguration().justification()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityPropertiesTests.java new file mode 100644 index 000000000000..375536225056 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityPropertiesTests.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalSettings; +import com.azure.resourcemanager.virtualenclaves.models.CommunityProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPropertiesPolicyOverride; +import com.azure.resourcemanager.virtualenclaves.models.FirewallSKU; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class CommunityPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommunityProperties model = BinaryData.fromString( + "{\"addressSpace\":\"hdneuelfph\",\"dnsServers\":[\"htozfikdow\",\"quuvxzxcl\",\"ithhqzon\",\"sg\"],\"provisioningState\":\"Failed\",\"resourceCollection\":[\"hfwdsjnkaljutiis\",\"acffgdkzzewkfvhq\"],\"managedResourceGroupName\":\"a\",\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"ppfufl\"},{\"id\":\"dmhdlxyjr\"}]},\"governedServiceList\":[{\"serviceId\":\"CosmosDB\",\"serviceName\":\"fcnihgwq\",\"option\":\"Deny\",\"enforcement\":\"Disabled\",\"policyAction\":\"Enforce\",\"initiatives\":[\"vkcvqvpkeqd\",\"vdrhvoo\",\"sotbob\",\"dopcjwvnh\"]},{\"serviceId\":\"ContainerRegistry\",\"serviceName\":\"wmgxcxrsl\",\"option\":\"Allow\",\"enforcement\":\"Enabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"rpkhjwn\",\"yqsluic\",\"dggkzzlvmbmpa\"]},{\"serviceId\":\"CosmosDB\",\"serviceName\":\"dfvue\",\"option\":\"Deny\",\"enforcement\":\"Enabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"wyhrfouyftaakc\",\"wiyzvqtmnubexkp\"]},{\"serviceId\":\"PrivateDNSZones\",\"serviceName\":\"mond\",\"option\":\"ExceptionOnly\",\"enforcement\":\"Enabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"mg\",\"opkwhojv\",\"ajqgxy\"]}],\"policyOverride\":\"None\",\"communityRoleAssignments\":[{\"roleDefinitionId\":\"bq\",\"principals\":[{\"id\":\"mkcxozapvh\",\"type\":\"User\"},{\"id\":\"xprglyatddc\",\"type\":\"User\"}]},{\"roleDefinitionId\":\"bcuejrjxgci\",\"principals\":[{\"id\":\"rhos\",\"type\":\"ServicePrincipal\"}]}],\"firewallSku\":\"Standard\",\"approvalSettings\":{\"endpointCreation\":\"NotRequired\",\"endpointUpdate\":\"Required\",\"endpointDeletion\":\"Required\",\"connectionCreation\":\"Required\",\"connectionUpdate\":\"Required\",\"connectionDeletion\":\"NotRequired\",\"enclaveCreation\":\"NotRequired\",\"enclaveDeletion\":\"Required\",\"maintenanceMode\":\"NotRequired\",\"serviceCatalogDeployment\":\"NotRequired\",\"notificationOnApprovalCreation\":\"NotRequired\",\"notificationOnApprovalAction\":\"NotRequired\",\"notificationOnApprovalDeletion\":\"NotRequired\",\"mandatoryApprovers\":[{\"approverEntraId\":\"ofyyvoqacpi\"},{\"approverEntraId\":\"xpbtgiwbwo\"},{\"approverEntraId\":\"nwashrtd\"},{\"approverEntraId\":\"kcnqxwbpo\"}],\"minimumApproversRequired\":8644340540999896271},\"maintenanceModeConfiguration\":{\"mode\":\"General\",\"principals\":[{\"id\":\"aasipqi\",\"type\":\"User\"},{\"id\":\"byuqerpqlp\",\"type\":\"ServicePrincipal\"}],\"justification\":\"Off\"}}") + .toObject(CommunityProperties.class); + Assertions.assertEquals("hdneuelfph", model.addressSpace()); + Assertions.assertEquals("htozfikdow", model.dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.COSMOS_DB, model.governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.DENY, model.governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.DISABLED, + model.governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.ENFORCE, + model.governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.NONE, model.policyOverride()); + Assertions.assertEquals("bq", model.communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("mkcxozapvh", model.communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.STANDARD, model.firewallSku()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().endpointCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.approvalSettings().endpointUpdate()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.approvalSettings().endpointDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.approvalSettings().connectionCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.approvalSettings().connectionUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().connectionDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().enclaveCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.approvalSettings().enclaveDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().maintenanceMode()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().serviceCatalogDeployment()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().notificationOnApprovalCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().notificationOnApprovalAction()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().notificationOnApprovalDeletion()); + Assertions.assertEquals("ofyyvoqacpi", model.approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(8644340540999896271L, model.approvalSettings().minimumApproversRequired()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.GENERAL, + model.maintenanceModeConfiguration().mode()); + Assertions.assertEquals("aasipqi", model.maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.OFF, + model.maintenanceModeConfiguration().justification()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommunityProperties model = new CommunityProperties().withAddressSpace("hdneuelfph") + .withDnsServers(Arrays.asList("htozfikdow", "quuvxzxcl", "ithhqzon", "sg")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withServiceId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.DENY) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.ENFORCE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.CONTAINER_REGISTRY) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY), + new GovernedServiceItem().withServiceId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.DENY) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY), + new GovernedServiceItem().withServiceId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.EXCEPTION_ONLY) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY))) + .withPolicyOverride(CommunityPropertiesPolicyOverride.NONE) + .withCommunityRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("bq") + .withPrincipals(Arrays.asList(new Principal().withId("mkcxozapvh").withType(PrincipalType.USER), + new Principal().withId("xprglyatddc").withType(PrincipalType.USER))), + new RoleAssignmentItem().withRoleDefinitionId("bcuejrjxgci") + .withPrincipals( + Arrays.asList(new Principal().withId("rhos").withType(PrincipalType.SERVICE_PRINCIPAL))))) + .withFirewallSku(FirewallSKU.STANDARD) + .withApprovalSettings(new ApprovalSettings().withEndpointCreation(ApprovalPolicy.NOT_REQUIRED) + .withEndpointUpdate(ApprovalPolicy.REQUIRED) + .withEndpointDeletion(ApprovalPolicy.REQUIRED) + .withConnectionCreation(ApprovalPolicy.REQUIRED) + .withConnectionUpdate(ApprovalPolicy.REQUIRED) + .withConnectionDeletion(ApprovalPolicy.NOT_REQUIRED) + .withEnclaveCreation(ApprovalPolicy.NOT_REQUIRED) + .withEnclaveDeletion(ApprovalPolicy.REQUIRED) + .withMaintenanceMode(ApprovalPolicy.NOT_REQUIRED) + .withServiceCatalogDeployment(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalCreation(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalAction(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalDeletion(ApprovalPolicy.NOT_REQUIRED) + .withMandatoryApprovers(Arrays.asList(new MandatoryApprover().withApproverEntraId("ofyyvoqacpi"), + new MandatoryApprover().withApproverEntraId("xpbtgiwbwo"), + new MandatoryApprover().withApproverEntraId("nwashrtd"), + new MandatoryApprover().withApproverEntraId("kcnqxwbpo"))) + .withMinimumApproversRequired(8644340540999896271L)) + .withMaintenanceModeConfiguration( + new MaintenanceModeConfigurationModel().withMode(MaintenanceModeConfigurationModelMode.GENERAL) + .withPrincipals(Arrays.asList(new Principal().withId("aasipqi").withType(PrincipalType.USER), + new Principal().withId("byuqerpqlp").withType(PrincipalType.SERVICE_PRINCIPAL))) + .withJustification(MaintenanceModeConfigurationModelJustification.OFF)); + model = BinaryData.fromObject(model).toObject(CommunityProperties.class); + Assertions.assertEquals("hdneuelfph", model.addressSpace()); + Assertions.assertEquals("htozfikdow", model.dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.COSMOS_DB, model.governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.DENY, model.governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.DISABLED, + model.governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.ENFORCE, + model.governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.NONE, model.policyOverride()); + Assertions.assertEquals("bq", model.communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("mkcxozapvh", model.communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.STANDARD, model.firewallSku()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().endpointCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.approvalSettings().endpointUpdate()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.approvalSettings().endpointDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.approvalSettings().connectionCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.approvalSettings().connectionUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().connectionDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().enclaveCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.approvalSettings().enclaveDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().maintenanceMode()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().serviceCatalogDeployment()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().notificationOnApprovalCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().notificationOnApprovalAction()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.approvalSettings().notificationOnApprovalDeletion()); + Assertions.assertEquals("ofyyvoqacpi", model.approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(8644340540999896271L, model.approvalSettings().minimumApproversRequired()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.GENERAL, + model.maintenanceModeConfiguration().mode()); + Assertions.assertEquals("aasipqi", model.maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.OFF, + model.maintenanceModeConfiguration().justification()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityResourceInnerTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityResourceInnerTests.java new file mode 100644 index 000000000000..d5269f616730 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityResourceInnerTests.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.fluent.models.CommunityResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalSettings; +import com.azure.resourcemanager.virtualenclaves.models.CommunityProperties; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPropertiesPolicyOverride; +import com.azure.resourcemanager.virtualenclaves.models.FirewallSKU; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CommunityResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommunityResourceInner model = BinaryData.fromString( + "{\"properties\":{\"addressSpace\":\"cwzzhxgktr\",\"dnsServers\":[\"cnapkteoell\",\"pt\",\"d\",\"gpfqbuace\"],\"provisioningState\":\"Running\",\"resourceCollection\":[\"rhhuaopppcqeqx\",\"lzdahzxctobgbkdm\"],\"managedResourceGroupName\":\"zpostmgrcfbu\",\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"jhhkxbp\"},{\"id\":\"ymjhxxjyngudivkr\"},{\"id\":\"wbxqzvszjfau\"},{\"id\":\"fdxxivetvtcqaqtd\"}]},\"governedServiceList\":[{\"serviceId\":\"Monitoring\",\"serviceName\":\"xv\",\"option\":\"Deny\",\"enforcement\":\"Enabled\",\"policyAction\":\"None\",\"initiatives\":[\"sfxobl\",\"tkblmpewww\",\"bkrvrnsvshqj\"]},{\"serviceId\":\"Storage\",\"serviceName\":\"crsbfovasr\",\"option\":\"Allow\",\"enforcement\":\"Disabled\",\"policyAction\":\"None\",\"initiatives\":[\"sub\",\"gjb\",\"rxbpyb\",\"rfbjf\"]},{\"serviceId\":\"MicrosoftSQL\",\"serviceName\":\"ssotftpv\",\"option\":\"NotApplicable\",\"enforcement\":\"Enabled\",\"policyAction\":\"Enforce\",\"initiatives\":[\"nfqqnvwp\",\"qtaruoujmkcjhwq\",\"tjrybnwjewgdr\",\"ervnaenqpehi\"]}],\"policyOverride\":\"Enclave\",\"communityRoleAssignments\":[{\"roleDefinitionId\":\"mifthnzdnd\",\"principals\":[{\"id\":\"nayqi\",\"type\":\"User\"},{\"id\":\"nduhavhqlkthum\",\"type\":\"Group\"},{\"id\":\"olbgycduiertgccy\",\"type\":\"Group\"}]},{\"roleDefinitionId\":\"aolps\",\"principals\":[{\"id\":\"lfmmdnbbglzpswi\",\"type\":\"User\"},{\"id\":\"mcwyhzdxssadb\",\"type\":\"ServicePrincipal\"},{\"id\":\"nvdfznuda\",\"type\":\"User\"}]},{\"roleDefinitionId\":\"vxzbncb\",\"principals\":[{\"id\":\"pstdbhhxsrzd\",\"type\":\"User\"},{\"id\":\"cers\",\"type\":\"ServicePrincipal\"},{\"id\":\"ntnev\",\"type\":\"ServicePrincipal\"},{\"id\":\"wjmy\",\"type\":\"Group\"}]}],\"firewallSku\":\"Basic\",\"approvalSettings\":{\"endpointCreation\":\"Required\",\"endpointUpdate\":\"NotRequired\",\"endpointDeletion\":\"NotRequired\",\"connectionCreation\":\"NotRequired\",\"connectionUpdate\":\"Required\",\"connectionDeletion\":\"NotRequired\",\"enclaveCreation\":\"Required\",\"enclaveDeletion\":\"NotRequired\",\"maintenanceMode\":\"NotRequired\",\"serviceCatalogDeployment\":\"Required\",\"notificationOnApprovalCreation\":\"Required\",\"notificationOnApprovalAction\":\"NotRequired\",\"notificationOnApprovalDeletion\":\"Required\",\"mandatoryApprovers\":[{\"approverEntraId\":\"zhedplvwiw\"},{\"approverEntraId\":\"bmwmbesldnkw\"},{\"approverEntraId\":\"tppjflcx\"}],\"minimumApproversRequired\":3058762238955275057},\"maintenanceModeConfiguration\":{\"mode\":\"Off\",\"principals\":[{\"id\":\"m\",\"type\":\"User\"}],\"justification\":\"Governance\"}},\"identity\":{\"principalId\":\"kqze\",\"tenantId\":\"kdltfzxmhhvhg\",\"type\":\"None\",\"userAssignedIdentities\":{\"xndlkzgxhu\":{\"principalId\":\"kwobdagxtibq\",\"clientId\":\"bxwakbog\"},\"lrb\":{\"principalId\":\"plbpodxun\",\"clientId\":\"ebxmubyynt\"}}},\"location\":\"koievseo\",\"tags\":{\"mpgcjefuzmuvpbt\":\"rlltmuwlauwzizx\"},\"id\":\"d\",\"name\":\"morppxebmnzbtbh\",\"type\":\"pglkf\"}") + .toObject(CommunityResourceInner.class); + Assertions.assertEquals("koievseo", model.location()); + Assertions.assertEquals("rlltmuwlauwzizx", model.tags().get("mpgcjefuzmuvpbt")); + Assertions.assertEquals("cwzzhxgktr", model.properties().addressSpace()); + Assertions.assertEquals("cnapkteoell", model.properties().dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.MONITORING, + model.properties().governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.DENY, + model.properties().governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.ENABLED, + model.properties().governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.NONE, + model.properties().governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.ENCLAVE, model.properties().policyOverride()); + Assertions.assertEquals("mifthnzdnd", model.properties().communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("nayqi", model.properties().communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, + model.properties().communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.BASIC, model.properties().firewallSku()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.properties().approvalSettings().endpointCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.properties().approvalSettings().endpointUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.properties().approvalSettings().endpointDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.properties().approvalSettings().connectionCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.properties().approvalSettings().connectionUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.properties().approvalSettings().connectionDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.properties().approvalSettings().enclaveCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.properties().approvalSettings().enclaveDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.properties().approvalSettings().maintenanceMode()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.properties().approvalSettings().serviceCatalogDeployment()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.properties().approvalSettings().notificationOnApprovalCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.properties().approvalSettings().notificationOnApprovalAction()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.properties().approvalSettings().notificationOnApprovalDeletion()); + Assertions.assertEquals("zhedplvwiw", + model.properties().approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(3058762238955275057L, model.properties().approvalSettings().minimumApproversRequired()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.OFF, + model.properties().maintenanceModeConfiguration().mode()); + Assertions.assertEquals("m", model.properties().maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, + model.properties().maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.GOVERNANCE, + model.properties().maintenanceModeConfiguration().justification()); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CommunityResourceInner model = new CommunityResourceInner().withLocation("koievseo") + .withTags(mapOf("mpgcjefuzmuvpbt", "rlltmuwlauwzizx")) + .withProperties(new CommunityProperties().withAddressSpace("cwzzhxgktr") + .withDnsServers(Arrays.asList("cnapkteoell", "pt", "d", "gpfqbuace")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withServiceId(ServiceIdentifier.MONITORING) + .withOption(GovernedServiceItemOption.DENY) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.STORAGE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.MICROSOFT_SQL) + .withOption(GovernedServiceItemOption.NOT_APPLICABLE) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.ENFORCE))) + .withPolicyOverride(CommunityPropertiesPolicyOverride.ENCLAVE) + .withCommunityRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("mifthnzdnd") + .withPrincipals(Arrays.asList(new Principal().withId("nayqi").withType(PrincipalType.USER), + new Principal().withId("nduhavhqlkthum").withType(PrincipalType.GROUP), + new Principal().withId("olbgycduiertgccy").withType(PrincipalType.GROUP))), + new RoleAssignmentItem().withRoleDefinitionId("aolps") + .withPrincipals( + Arrays.asList(new Principal().withId("lfmmdnbbglzpswi").withType(PrincipalType.USER), + new Principal().withId("mcwyhzdxssadb").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("nvdfznuda").withType(PrincipalType.USER))), + new RoleAssignmentItem().withRoleDefinitionId("vxzbncb") + .withPrincipals( + Arrays.asList(new Principal().withId("pstdbhhxsrzd").withType(PrincipalType.USER), + new Principal().withId("cers").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("ntnev").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("wjmy").withType(PrincipalType.GROUP))))) + .withFirewallSku(FirewallSKU.BASIC) + .withApprovalSettings(new ApprovalSettings().withEndpointCreation(ApprovalPolicy.REQUIRED) + .withEndpointUpdate(ApprovalPolicy.NOT_REQUIRED) + .withEndpointDeletion(ApprovalPolicy.NOT_REQUIRED) + .withConnectionCreation(ApprovalPolicy.NOT_REQUIRED) + .withConnectionUpdate(ApprovalPolicy.REQUIRED) + .withConnectionDeletion(ApprovalPolicy.NOT_REQUIRED) + .withEnclaveCreation(ApprovalPolicy.REQUIRED) + .withEnclaveDeletion(ApprovalPolicy.NOT_REQUIRED) + .withMaintenanceMode(ApprovalPolicy.NOT_REQUIRED) + .withServiceCatalogDeployment(ApprovalPolicy.REQUIRED) + .withNotificationOnApprovalCreation(ApprovalPolicy.REQUIRED) + .withNotificationOnApprovalAction(ApprovalPolicy.NOT_REQUIRED) + .withNotificationOnApprovalDeletion(ApprovalPolicy.REQUIRED) + .withMandatoryApprovers(Arrays.asList(new MandatoryApprover().withApproverEntraId("zhedplvwiw"), + new MandatoryApprover().withApproverEntraId("bmwmbesldnkw"), + new MandatoryApprover().withApproverEntraId("tppjflcx"))) + .withMinimumApproversRequired(3058762238955275057L)) + .withMaintenanceModeConfiguration( + new MaintenanceModeConfigurationModel().withMode(MaintenanceModeConfigurationModelMode.OFF) + .withPrincipals(Arrays.asList(new Principal().withId("m").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationModelJustification.GOVERNANCE))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities( + mapOf("xndlkzgxhu", new UserAssignedIdentity(), "lrb", new UserAssignedIdentity()))); + model = BinaryData.fromObject(model).toObject(CommunityResourceInner.class); + Assertions.assertEquals("koievseo", model.location()); + Assertions.assertEquals("rlltmuwlauwzizx", model.tags().get("mpgcjefuzmuvpbt")); + Assertions.assertEquals("cwzzhxgktr", model.properties().addressSpace()); + Assertions.assertEquals("cnapkteoell", model.properties().dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.MONITORING, + model.properties().governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.DENY, + model.properties().governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.ENABLED, + model.properties().governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.NONE, + model.properties().governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.ENCLAVE, model.properties().policyOverride()); + Assertions.assertEquals("mifthnzdnd", model.properties().communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("nayqi", model.properties().communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, + model.properties().communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.BASIC, model.properties().firewallSku()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.properties().approvalSettings().endpointCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.properties().approvalSettings().endpointUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.properties().approvalSettings().endpointDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.properties().approvalSettings().connectionCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.properties().approvalSettings().connectionUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.properties().approvalSettings().connectionDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, model.properties().approvalSettings().enclaveCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.properties().approvalSettings().enclaveDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, model.properties().approvalSettings().maintenanceMode()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.properties().approvalSettings().serviceCatalogDeployment()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.properties().approvalSettings().notificationOnApprovalCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.properties().approvalSettings().notificationOnApprovalAction()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.properties().approvalSettings().notificationOnApprovalDeletion()); + Assertions.assertEquals("zhedplvwiw", + model.properties().approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(3058762238955275057L, model.properties().approvalSettings().minimumApproversRequired()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.OFF, + model.properties().maintenanceModeConfiguration().mode()); + Assertions.assertEquals("m", model.properties().maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, + model.properties().maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.GOVERNANCE, + model.properties().maintenanceModeConfiguration().justification()); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityResourceListResultTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityResourceListResultTests.java new file mode 100644 index 000000000000..531b26547d40 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/CommunityResourceListResultTests.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.implementation.models.CommunityResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalPolicy; +import com.azure.resourcemanager.virtualenclaves.models.CommunityPropertiesPolicyOverride; +import com.azure.resourcemanager.virtualenclaves.models.FirewallSKU; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import org.junit.jupiter.api.Assertions; + +public final class CommunityResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CommunityResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"addressSpace\":\"kgjubgdknnqvsazn\",\"dnsServers\":[\"orudsgsa\"],\"provisioningState\":\"Updating\",\"resourceCollection\":[\"grauwjuetaebur\"],\"managedResourceGroupName\":\"dmovsm\",\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{}]},\"governedServiceList\":[{\"serviceId\":\"AKS\",\"serviceName\":\"oefki\",\"option\":\"ExceptionOnly\",\"enforcement\":\"Disabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"mqlgk\",\"btndo\"]}],\"policyOverride\":\"Enclave\",\"communityRoleAssignments\":[{\"roleDefinitionId\":\"jcntuj\",\"principals\":[{\"id\":\"jed\",\"type\":\"User\"}]},{\"roleDefinitionId\":\"wwa\",\"principals\":[{\"id\":\"ojvdcpzfoqo\",\"type\":\"ServicePrincipal\"},{\"id\":\"cybxa\",\"type\":\"Group\"}]},{\"roleDefinitionId\":\"gszufoxciqopid\",\"principals\":[{\"id\":\"ciodhkhaz\",\"type\":\"Group\"},{\"id\":\"hnzbonl\",\"type\":\"User\"},{\"id\":\"toego\",\"type\":\"User\"},{\"id\":\"wbw\",\"type\":\"ServicePrincipal\"}]}],\"firewallSku\":\"Basic\",\"approvalSettings\":{\"endpointCreation\":\"Required\",\"endpointUpdate\":\"NotRequired\",\"endpointDeletion\":\"NotRequired\",\"connectionCreation\":\"Required\",\"connectionUpdate\":\"Required\",\"connectionDeletion\":\"NotRequired\",\"enclaveCreation\":\"NotRequired\",\"enclaveDeletion\":\"Required\",\"maintenanceMode\":\"Required\",\"serviceCatalogDeployment\":\"NotRequired\",\"notificationOnApprovalCreation\":\"NotRequired\",\"notificationOnApprovalAction\":\"Required\",\"notificationOnApprovalDeletion\":\"Required\",\"mandatoryApprovers\":[{\"approverEntraId\":\"guxawqaldsyuuxi\"},{\"approverEntraId\":\"erqf\"},{\"approverEntraId\":\"bw\"}],\"minimumApproversRequired\":3779692403616997891},\"maintenanceModeConfiguration\":{\"mode\":\"CanNotDelete\",\"principals\":[{\"id\":\"t\",\"type\":\"Group\"},{\"id\":\"fhpagmhrskdsnf\",\"type\":\"ServicePrincipal\"}],\"justification\":\"Governance\"}},\"identity\":{\"principalId\":\"gtdlmk\",\"tenantId\":\"evdlh\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"akufgmjz\":{\"principalId\":\"dsttwvo\",\"clientId\":\"bbejdcngqqm\"},\"nrfdw\":{\"principalId\":\"rdgrtw\",\"clientId\":\"nuuzkopbm\"}}},\"location\":\"uhhziuiefozbhdm\",\"tags\":{\"hxicslfaoqz\":\"mzqhoftrmaequi\"},\"id\":\"iyylhalnswhccsp\",\"name\":\"kaivwit\",\"type\":\"scywuggwoluhc\"}],\"nextLink\":\"wem\"}") + .toObject(CommunityResourceListResult.class); + Assertions.assertEquals("uhhziuiefozbhdm", model.value().get(0).location()); + Assertions.assertEquals("mzqhoftrmaequi", model.value().get(0).tags().get("hxicslfaoqz")); + Assertions.assertEquals("kgjubgdknnqvsazn", model.value().get(0).properties().addressSpace()); + Assertions.assertEquals("orudsgsa", model.value().get(0).properties().dnsServers().get(0)); + Assertions.assertEquals(ServiceIdentifier.AKS, + model.value().get(0).properties().governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.EXCEPTION_ONLY, + model.value().get(0).properties().governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.DISABLED, + model.value().get(0).properties().governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.AUDIT_ONLY, + model.value().get(0).properties().governedServiceList().get(0).policyAction()); + Assertions.assertEquals(CommunityPropertiesPolicyOverride.ENCLAVE, + model.value().get(0).properties().policyOverride()); + Assertions.assertEquals("jcntuj", + model.value().get(0).properties().communityRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("jed", + model.value().get(0).properties().communityRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, + model.value().get(0).properties().communityRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(FirewallSKU.BASIC, model.value().get(0).properties().firewallSku()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.value().get(0).properties().approvalSettings().endpointCreation()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.value().get(0).properties().approvalSettings().endpointUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.value().get(0).properties().approvalSettings().endpointDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.value().get(0).properties().approvalSettings().connectionCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.value().get(0).properties().approvalSettings().connectionUpdate()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.value().get(0).properties().approvalSettings().connectionDeletion()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.value().get(0).properties().approvalSettings().enclaveCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.value().get(0).properties().approvalSettings().enclaveDeletion()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.value().get(0).properties().approvalSettings().maintenanceMode()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.value().get(0).properties().approvalSettings().serviceCatalogDeployment()); + Assertions.assertEquals(ApprovalPolicy.NOT_REQUIRED, + model.value().get(0).properties().approvalSettings().notificationOnApprovalCreation()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.value().get(0).properties().approvalSettings().notificationOnApprovalAction()); + Assertions.assertEquals(ApprovalPolicy.REQUIRED, + model.value().get(0).properties().approvalSettings().notificationOnApprovalDeletion()); + Assertions.assertEquals("guxawqaldsyuuxi", + model.value().get(0).properties().approvalSettings().mandatoryApprovers().get(0).approverEntraId()); + Assertions.assertEquals(3779692403616997891L, + model.value().get(0).properties().approvalSettings().minimumApproversRequired()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.CAN_NOT_DELETE, + model.value().get(0).properties().maintenanceModeConfiguration().mode()); + Assertions.assertEquals("t", + model.value().get(0).properties().maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.GROUP, + model.value().get(0).properties().maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.GOVERNANCE, + model.value().get(0).properties().maintenanceModeConfiguration().justification()); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, + model.value().get(0).identity().type()); + Assertions.assertEquals("wem", model.nextLink()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveAddressSpacesModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveAddressSpacesModelTests.java new file mode 100644 index 000000000000..73112854be1c --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveAddressSpacesModelTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveAddressSpacesModel; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveAddressSpacesModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveAddressSpacesModel model = BinaryData + .fromString("{\"enclaveAddressSpace\":\"dsfcpkvxodpuoz\",\"managedAddressSpace\":\"zydagfuaxbezyiuo\"}") + .toObject(EnclaveAddressSpacesModel.class); + Assertions.assertEquals("dsfcpkvxodpuoz", model.enclaveAddressSpace()); + Assertions.assertEquals("zydagfuaxbezyiuo", model.managedAddressSpace()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionPatchModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionPatchModelTests.java new file mode 100644 index 000000000000..f5127696c3e7 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionPatchModelTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveConnectionPatchModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveConnectionPatchModel model + = BinaryData.fromString("{\"properties\":{\"sourceCidr\":\"qmt\"},\"tags\":{\"wau\":\"tmmjihyeozph\"}}") + .toObject(EnclaveConnectionPatchModel.class); + Assertions.assertEquals("qmt", model.properties().sourceCidr()); + Assertions.assertEquals("tmmjihyeozph", model.tags().get("wau")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnclaveConnectionPatchModel model = new EnclaveConnectionPatchModel() + .withProperties(new EnclaveConnectionPatchProperties().withSourceCidr("qmt")) + .withTags(mapOf("wau", "tmmjihyeozph")); + model = BinaryData.fromObject(model).toObject(EnclaveConnectionPatchModel.class); + Assertions.assertEquals("qmt", model.properties().sourceCidr()); + Assertions.assertEquals("tmmjihyeozph", model.tags().get("wau")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionPatchPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionPatchPropertiesTests.java new file mode 100644 index 000000000000..d62ca669f5b2 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionPatchPropertiesTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionPatchProperties; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveConnectionPatchPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveConnectionPatchProperties model + = BinaryData.fromString("{\"sourceCidr\":\"ncyg\"}").toObject(EnclaveConnectionPatchProperties.class); + Assertions.assertEquals("ncyg", model.sourceCidr()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnclaveConnectionPatchProperties model = new EnclaveConnectionPatchProperties().withSourceCidr("ncyg"); + model = BinaryData.fromObject(model).toObject(EnclaveConnectionPatchProperties.class); + Assertions.assertEquals("ncyg", model.sourceCidr()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionPropertiesTests.java new file mode 100644 index 000000000000..b025aace25ed --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionPropertiesTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionProperties; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveConnectionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveConnectionProperties model = BinaryData.fromString( + "{\"state\":\"PendingApproval\",\"communityResourceId\":\"jlwuenvrkp\",\"sourceResourceId\":\"ou\",\"sourceCidr\":\"bre\",\"destinationEndpointId\":\"qaaysjkixqt\",\"provisioningState\":\"Running\",\"resourceCollection\":[\"zlwfffiakp\"]}") + .toObject(EnclaveConnectionProperties.class); + Assertions.assertEquals("jlwuenvrkp", model.communityResourceId()); + Assertions.assertEquals("ou", model.sourceResourceId()); + Assertions.assertEquals("bre", model.sourceCidr()); + Assertions.assertEquals("qaaysjkixqt", model.destinationEndpointId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnclaveConnectionProperties model = new EnclaveConnectionProperties().withCommunityResourceId("jlwuenvrkp") + .withSourceResourceId("ou") + .withSourceCidr("bre") + .withDestinationEndpointId("qaaysjkixqt"); + model = BinaryData.fromObject(model).toObject(EnclaveConnectionProperties.class); + Assertions.assertEquals("jlwuenvrkp", model.communityResourceId()); + Assertions.assertEquals("ou", model.sourceResourceId()); + Assertions.assertEquals("bre", model.sourceCidr()); + Assertions.assertEquals("qaaysjkixqt", model.destinationEndpointId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionResourceInnerTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionResourceInnerTests.java new file mode 100644 index 000000000000..5f76c7572450 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionResourceInnerTests.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveConnectionResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveConnectionResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveConnectionResourceInner model = BinaryData.fromString( + "{\"properties\":{\"state\":\"Disconnected\",\"communityResourceId\":\"tlpdn\",\"sourceResourceId\":\"itvgbmhrixkwm\",\"sourceCidr\":\"jejveg\",\"destinationEndpointId\":\"hbpnaixexccbd\",\"provisioningState\":\"Deleting\",\"resourceCollection\":[\"cexdrrvqa\",\"qkghtpwijnhy\",\"svfycxzbfv\"]},\"location\":\"wvrvmtg\",\"tags\":{\"nsxkmcwaekrrjr\":\"pyostronzmyhgfi\",\"jglikkxwslolb\":\"afxtsgum\",\"elfk\":\"pvuzlmv\",\"njwmwkpnbsazejj\":\"gplcrpwjxeznoigb\"},\"id\":\"qkagfhsxt\",\"name\":\"augzxnfaazpxdtn\",\"type\":\"dm\"}") + .toObject(EnclaveConnectionResourceInner.class); + Assertions.assertEquals("wvrvmtg", model.location()); + Assertions.assertEquals("pyostronzmyhgfi", model.tags().get("nsxkmcwaekrrjr")); + Assertions.assertEquals("tlpdn", model.properties().communityResourceId()); + Assertions.assertEquals("itvgbmhrixkwm", model.properties().sourceResourceId()); + Assertions.assertEquals("jejveg", model.properties().sourceCidr()); + Assertions.assertEquals("hbpnaixexccbd", model.properties().destinationEndpointId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnclaveConnectionResourceInner model = new EnclaveConnectionResourceInner().withLocation("wvrvmtg") + .withTags(mapOf("nsxkmcwaekrrjr", "pyostronzmyhgfi", "jglikkxwslolb", "afxtsgum", "elfk", "pvuzlmv", + "njwmwkpnbsazejj", "gplcrpwjxeznoigb")) + .withProperties(new EnclaveConnectionProperties().withCommunityResourceId("tlpdn") + .withSourceResourceId("itvgbmhrixkwm") + .withSourceCidr("jejveg") + .withDestinationEndpointId("hbpnaixexccbd")); + model = BinaryData.fromObject(model).toObject(EnclaveConnectionResourceInner.class); + Assertions.assertEquals("wvrvmtg", model.location()); + Assertions.assertEquals("pyostronzmyhgfi", model.tags().get("nsxkmcwaekrrjr")); + Assertions.assertEquals("tlpdn", model.properties().communityResourceId()); + Assertions.assertEquals("itvgbmhrixkwm", model.properties().sourceResourceId()); + Assertions.assertEquals("jejveg", model.properties().sourceCidr()); + Assertions.assertEquals("hbpnaixexccbd", model.properties().destinationEndpointId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionResourceListResultTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionResourceListResultTests.java new file mode 100644 index 000000000000..fd92ceab5b1a --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionResourceListResultTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.implementation.models.EnclaveConnectionResourceListResult; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveConnectionResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveConnectionResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"state\":\"Disconnected\",\"communityResourceId\":\"p\",\"sourceResourceId\":\"dscwxqupevzhf\",\"sourceCidr\":\"otxhojujby\",\"destinationEndpointId\":\"elmcuvhixbjxyfw\",\"provisioningState\":\"Canceled\",\"resourceCollection\":[\"ool\",\"ttpkiwkkbnujrywv\",\"y\",\"bfpncurdo\"]},\"location\":\"iithtywu\",\"tags\":{\"jchrdgoihxumw\":\"bihwqknfdnt\",\"zj\":\"ton\"},\"id\":\"uu\",\"name\":\"fdlwg\",\"type\":\"ytsbwtovv\"}],\"nextLink\":\"seinqfiuf\"}") + .toObject(EnclaveConnectionResourceListResult.class); + Assertions.assertEquals("iithtywu", model.value().get(0).location()); + Assertions.assertEquals("bihwqknfdnt", model.value().get(0).tags().get("jchrdgoihxumw")); + Assertions.assertEquals("p", model.value().get(0).properties().communityResourceId()); + Assertions.assertEquals("dscwxqupevzhf", model.value().get(0).properties().sourceResourceId()); + Assertions.assertEquals("otxhojujby", model.value().get(0).properties().sourceCidr()); + Assertions.assertEquals("elmcuvhixbjxyfw", model.value().get(0).properties().destinationEndpointId()); + Assertions.assertEquals("seinqfiuf", model.nextLink()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsCreateOrUpdateMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..2722175a1cd1 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsCreateOrUpdateMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveConnectionsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"state\":\"Approved\",\"communityResourceId\":\"vbxgkqusyb\",\"sourceResourceId\":\"ptdacarvvl\",\"sourceCidr\":\"tymtpoiwenazer\",\"destinationEndpointId\":\"hzr\",\"provisioningState\":\"Succeeded\",\"resourceCollection\":[\"xkdnwqapf\",\"sdpcvess\",\"zhhkuuipldqqc\",\"ekvalblhtjq\"]},\"location\":\"yvwehtaemxh\",\"tags\":{\"usxivzrrryvei\":\"se\"},\"id\":\"ipsk\",\"name\":\"yzatvfuzkaft\",\"type\":\"vvruxwi\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + EnclaveConnectionResource response = manager.enclaveConnections() + .define("qsczpgvdwnapfdqw") + .withRegion("xfkndlqvtwknvgm") + .withExistingResourceGroup("zffovwmbjl") + .withTags( + mapOf("tgroesh", "gtywatmqaqkue", "yf", "ygzc", "faoytehqpuv", "x", "ndljdjuskbr", "mvqmtdwckygroej")) + .withProperties(new EnclaveConnectionProperties().withCommunityResourceId("ptnuwjtkschgc") + .withSourceResourceId("qyhleseyq") + .withSourceCidr("vyeldot") + .withDestinationEndpointId("v")) + .create(); + + Assertions.assertEquals("yvwehtaemxh", response.location()); + Assertions.assertEquals("se", response.tags().get("usxivzrrryvei")); + Assertions.assertEquals("vbxgkqusyb", response.properties().communityResourceId()); + Assertions.assertEquals("ptdacarvvl", response.properties().sourceResourceId()); + Assertions.assertEquals("tymtpoiwenazer", response.properties().sourceCidr()); + Assertions.assertEquals("hzr", response.properties().destinationEndpointId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsGetByResourceGroupWithResponseMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..121cf9c1ff63 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveConnectionsGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"state\":\"Failed\",\"communityResourceId\":\"qxnhmb\",\"sourceResourceId\":\"eznjaujv\",\"sourceCidr\":\"nnggiycwkdtaawxw\",\"destinationEndpointId\":\"ekaum\",\"provisioningState\":\"Failed\",\"resourceCollection\":[\"zmqkratbnxwbjs\",\"dbirkfpksokdgo\",\"ewijymrhbguz\"]},\"location\":\"kyewnfnzhhhqo\",\"tags\":{\"g\":\"fjkutycyarnroo\",\"ocnhzqrottjzcfyj\":\"abzoghktdpyczhco\",\"rl\":\"pt\",\"pqinf\":\"h\"},\"id\":\"zpyglqdhmrj\",\"name\":\"ralcxpjbyypsj\",\"type\":\"qcjenkyhf\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + EnclaveConnectionResource response = manager.enclaveConnections() + .getByResourceGroupWithResponse("xxahmrnadzyqegxy", "vpinbmhwbj", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("kyewnfnzhhhqo", response.location()); + Assertions.assertEquals("fjkutycyarnroo", response.tags().get("g")); + Assertions.assertEquals("qxnhmb", response.properties().communityResourceId()); + Assertions.assertEquals("eznjaujv", response.properties().sourceResourceId()); + Assertions.assertEquals("nnggiycwkdtaawxw", response.properties().sourceCidr()); + Assertions.assertEquals("ekaum", response.properties().destinationEndpointId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsHandleApprovalCreationMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsHandleApprovalCreationMockTests.java new file mode 100644 index 000000000000..aa591dab75d3 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsHandleApprovalCreationMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveConnectionsHandleApprovalCreationMockTests { + @Test + public void testHandleApprovalCreation() throws Exception { + String responseStr = "{\"message\":\"sioycblevpmcl\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ApprovalActionResponse response = manager.enclaveConnections() + .handleApprovalCreation("dbrxmrgc", "bapxkiyfjjkb", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.DELETE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.REJECTED) + .withApprovalCallbackPayload("scgdu"), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("sioycblevpmcl", response.message()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsHandleApprovalDeletionMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsHandleApprovalDeletionMockTests.java new file mode 100644 index 000000000000..22d46d71fe0f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsHandleApprovalDeletionMockTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveConnectionsHandleApprovalDeletionMockTests { + @Test + public void testHandleApprovalDeletion() throws Exception { + String responseStr = "{\"message\":\"sjgkzzltafh\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ApprovalActionResponse response = manager.enclaveConnections() + .handleApprovalDeletion("jy", "kyxl", new ApprovalDeletionCallbackRequest().withResourceRequestAction( + ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), com.azure.core.util.Context.NONE); + + Assertions.assertEquals("sjgkzzltafh", response.message()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsListByResourceGroupMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsListByResourceGroupMockTests.java new file mode 100644 index 000000000000..a78c598b98c4 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsListByResourceGroupMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveConnectionsListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"state\":\"Active\",\"communityResourceId\":\"xj\",\"sourceResourceId\":\"l\",\"sourceCidr\":\"mpzqjhhhq\",\"destinationEndpointId\":\"uwyvcacoyvi\",\"provisioningState\":\"Deleting\",\"resourceCollection\":[\"usjszlbscm\",\"lzijiufehgmvflnw\"]},\"location\":\"qkxrerl\",\"tags\":{\"whghmup\":\"lylyfwxzutgqz\"},\"id\":\"xyjtcdxabbujf\",\"name\":\"abe\",\"type\":\"bbklqpxzuca\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.enclaveConnections().listByResourceGroup("zv", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qkxrerl", response.iterator().next().location()); + Assertions.assertEquals("lylyfwxzutgqz", response.iterator().next().tags().get("whghmup")); + Assertions.assertEquals("xj", response.iterator().next().properties().communityResourceId()); + Assertions.assertEquals("l", response.iterator().next().properties().sourceResourceId()); + Assertions.assertEquals("mpzqjhhhq", response.iterator().next().properties().sourceCidr()); + Assertions.assertEquals("uwyvcacoyvi", response.iterator().next().properties().destinationEndpointId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsListMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsListMockTests.java new file mode 100644 index 000000000000..8f8454473d44 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveConnectionsListMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveConnectionResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveConnectionsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"state\":\"Approved\",\"communityResourceId\":\"wwnlzafwxudgnh\",\"sourceResourceId\":\"ookrtalvnbw\",\"sourceCidr\":\"bemeluclvd\",\"destinationEndpointId\":\"jukyrdn\",\"provisioningState\":\"Canceled\",\"resourceCollection\":[\"hhxhq\",\"aqnvzoqgyipemchg\",\"v\",\"czuejdtxptl\"]},\"location\":\"wzhomewjjstl\",\"tags\":{\"nvodrrs\":\"qawmoaianc\",\"vvbxiwkgfbqljnq\":\"blxydkxr\"},\"id\":\"hychocokuleh\",\"name\":\"rqlrqffawe\",\"type\":\"urkphyjdxravju\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.enclaveConnections().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("wzhomewjjstl", response.iterator().next().location()); + Assertions.assertEquals("qawmoaianc", response.iterator().next().tags().get("nvodrrs")); + Assertions.assertEquals("wwnlzafwxudgnh", response.iterator().next().properties().communityResourceId()); + Assertions.assertEquals("ookrtalvnbw", response.iterator().next().properties().sourceResourceId()); + Assertions.assertEquals("bemeluclvd", response.iterator().next().properties().sourceCidr()); + Assertions.assertEquals("jukyrdn", response.iterator().next().properties().destinationEndpointId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveDefaultSettingsPatchModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveDefaultSettingsPatchModelTests.java new file mode 100644 index 000000000000..27bfdf2bdd6a --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveDefaultSettingsPatchModelTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.DiagnosticDestination; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveDefaultSettingsPatchModel; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveDefaultSettingsPatchModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveDefaultSettingsPatchModel model = BinaryData.fromString("{\"diagnosticDestination\":\"CommunityOnly\"}") + .toObject(EnclaveDefaultSettingsPatchModel.class); + Assertions.assertEquals(DiagnosticDestination.COMMUNITY_ONLY, model.diagnosticDestination()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnclaveDefaultSettingsPatchModel model + = new EnclaveDefaultSettingsPatchModel().withDiagnosticDestination(DiagnosticDestination.COMMUNITY_ONLY); + model = BinaryData.fromObject(model).toObject(EnclaveDefaultSettingsPatchModel.class); + Assertions.assertEquals(DiagnosticDestination.COMMUNITY_ONLY, model.diagnosticDestination()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointDestinationRuleTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointDestinationRuleTests.java new file mode 100644 index 000000000000..1d72ede1c49e --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointDestinationRuleTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveEndpointDestinationRuleTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveEndpointDestinationRule model = BinaryData.fromString( + "{\"protocols\":[\"UDP\"],\"endpointRuleName\":\"zpnfqntcypsxj\",\"destination\":\"oimwkslirc\",\"ports\":\"jxv\"}") + .toObject(EnclaveEndpointDestinationRule.class); + Assertions.assertEquals(EnclaveEndpointProtocol.UDP, model.protocols().get(0)); + Assertions.assertEquals("zpnfqntcypsxj", model.endpointRuleName()); + Assertions.assertEquals("oimwkslirc", model.destination()); + Assertions.assertEquals("jxv", model.ports()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnclaveEndpointDestinationRule model + = new EnclaveEndpointDestinationRule().withProtocols(Arrays.asList(EnclaveEndpointProtocol.UDP)) + .withEndpointRuleName("zpnfqntcypsxj") + .withDestination("oimwkslirc") + .withPorts("jxv"); + model = BinaryData.fromObject(model).toObject(EnclaveEndpointDestinationRule.class); + Assertions.assertEquals(EnclaveEndpointProtocol.UDP, model.protocols().get(0)); + Assertions.assertEquals("zpnfqntcypsxj", model.endpointRuleName()); + Assertions.assertEquals("oimwkslirc", model.destination()); + Assertions.assertEquals("jxv", model.ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointPatchModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointPatchModelTests.java new file mode 100644 index 000000000000..7efb5fb1e124 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointPatchModelTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveEndpointPatchModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveEndpointPatchModel model = BinaryData.fromString( + "{\"properties\":{\"ruleCollection\":[{\"protocols\":[\"ANY\",\"ESP\"],\"endpointRuleName\":\"lhvygdyftu\",\"destination\":\"twnawjslbiwkojgc\",\"ports\":\"tsf\"},{\"protocols\":[\"TCP\",\"AH\",\"ANY\"],\"endpointRuleName\":\"ph\",\"destination\":\"qnrnrpxehuwryk\",\"ports\":\"aifmvikl\"},{\"protocols\":[\"AH\"],\"endpointRuleName\":\"hbejdznxcvdsrhnj\",\"destination\":\"olvtnovqfzge\",\"ports\":\"dftuljltduce\"}]},\"tags\":{\"ejwcwwqiok\":\"mczuo\",\"p\":\"ssxmojms\",\"kwcf\":\"jpr\",\"yxgtczh\":\"ql\"}}") + .toObject(EnclaveEndpointPatchModel.class); + Assertions.assertEquals(EnclaveEndpointProtocol.ANY, + model.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("lhvygdyftu", model.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("twnawjslbiwkojgc", model.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("tsf", model.properties().ruleCollection().get(0).ports()); + Assertions.assertEquals("mczuo", model.tags().get("ejwcwwqiok")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnclaveEndpointPatchModel model + = new EnclaveEndpointPatchModel() + .withProperties( + new EnclaveEndpointPatchProperties() + .withRuleCollection( + Arrays.asList( + new EnclaveEndpointDestinationRule() + .withProtocols( + Arrays.asList(EnclaveEndpointProtocol.ANY, EnclaveEndpointProtocol.ESP)) + .withEndpointRuleName("lhvygdyftu") + .withDestination("twnawjslbiwkojgc") + .withPorts("tsf"), + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP, + EnclaveEndpointProtocol.AH, EnclaveEndpointProtocol.ANY)) + .withEndpointRuleName("ph") + .withDestination("qnrnrpxehuwryk") + .withPorts("aifmvikl"), + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.AH)) + .withEndpointRuleName("hbejdznxcvdsrhnj") + .withDestination("olvtnovqfzge") + .withPorts("dftuljltduce")))) + .withTags(mapOf("ejwcwwqiok", "mczuo", "p", "ssxmojms", "kwcf", "jpr", "yxgtczh", "ql")); + model = BinaryData.fromObject(model).toObject(EnclaveEndpointPatchModel.class); + Assertions.assertEquals(EnclaveEndpointProtocol.ANY, + model.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("lhvygdyftu", model.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("twnawjslbiwkojgc", model.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("tsf", model.properties().ruleCollection().get(0).ports()); + Assertions.assertEquals("mczuo", model.tags().get("ejwcwwqiok")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointPatchPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointPatchPropertiesTests.java new file mode 100644 index 000000000000..c6f9f1613d66 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointPatchPropertiesTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveEndpointPatchPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveEndpointPatchProperties model = BinaryData.fromString( + "{\"ruleCollection\":[{\"protocols\":[\"TCP\",\"UDP\",\"AH\",\"UDP\"],\"endpointRuleName\":\"kx\",\"destination\":\"ehvbbxurip\",\"ports\":\"fnhtbaxkgxyw\"},{\"protocols\":[\"UDP\",\"AH\"],\"endpointRuleName\":\"lyhpluodpvruud\",\"destination\":\"zibt\",\"ports\":\"stgktst\"}]}") + .toObject(EnclaveEndpointPatchProperties.class); + Assertions.assertEquals(EnclaveEndpointProtocol.TCP, model.ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("kx", model.ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("ehvbbxurip", model.ruleCollection().get(0).destination()); + Assertions.assertEquals("fnhtbaxkgxyw", model.ruleCollection().get(0).ports()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnclaveEndpointPatchProperties model = new EnclaveEndpointPatchProperties().withRuleCollection(Arrays.asList( + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP, EnclaveEndpointProtocol.UDP, + EnclaveEndpointProtocol.AH, EnclaveEndpointProtocol.UDP)) + .withEndpointRuleName("kx") + .withDestination("ehvbbxurip") + .withPorts("fnhtbaxkgxyw"), + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.UDP, EnclaveEndpointProtocol.AH)) + .withEndpointRuleName("lyhpluodpvruud") + .withDestination("zibt") + .withPorts("stgktst"))); + model = BinaryData.fromObject(model).toObject(EnclaveEndpointPatchProperties.class); + Assertions.assertEquals(EnclaveEndpointProtocol.TCP, model.ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("kx", model.ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("ehvbbxurip", model.ruleCollection().get(0).destination()); + Assertions.assertEquals("fnhtbaxkgxyw", model.ruleCollection().get(0).ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointPropertiesTests.java new file mode 100644 index 000000000000..851f7c73c520 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointPropertiesTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveEndpointPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveEndpointProperties model = BinaryData.fromString( + "{\"ruleCollection\":[{\"protocols\":[\"ANY\",\"ANY\"],\"endpointRuleName\":\"ojfmwnco\",\"destination\":\"rfh\",\"ports\":\"ctymoxoftp\"},{\"protocols\":[\"ESP\",\"ANY\"],\"endpointRuleName\":\"zuhx\",\"destination\":\"pqjlihhyusps\",\"ports\":\"sdvlmfwdgzxulucv\"},{\"protocols\":[\"ESP\",\"ICMP\",\"UDP\",\"ICMP\"],\"endpointRuleName\":\"zvxurisjnhny\",\"destination\":\"ifqjz\",\"ports\":\"mrhublwpc\"}],\"resourceCollection\":[\"trgjupauutpwoqh\"],\"provisioningState\":\"Running\"}") + .toObject(EnclaveEndpointProperties.class); + Assertions.assertEquals(EnclaveEndpointProtocol.ANY, model.ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("ojfmwnco", model.ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("rfh", model.ruleCollection().get(0).destination()); + Assertions.assertEquals("ctymoxoftp", model.ruleCollection().get(0).ports()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnclaveEndpointProperties model = new EnclaveEndpointProperties().withRuleCollection(Arrays.asList( + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.ANY, EnclaveEndpointProtocol.ANY)) + .withEndpointRuleName("ojfmwnco") + .withDestination("rfh") + .withPorts("ctymoxoftp"), + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.ESP, EnclaveEndpointProtocol.ANY)) + .withEndpointRuleName("zuhx") + .withDestination("pqjlihhyusps") + .withPorts("sdvlmfwdgzxulucv"), + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.ESP, EnclaveEndpointProtocol.ICMP, + EnclaveEndpointProtocol.UDP, EnclaveEndpointProtocol.ICMP)) + .withEndpointRuleName("zvxurisjnhny") + .withDestination("ifqjz") + .withPorts("mrhublwpc"))); + model = BinaryData.fromObject(model).toObject(EnclaveEndpointProperties.class); + Assertions.assertEquals(EnclaveEndpointProtocol.ANY, model.ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("ojfmwnco", model.ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("rfh", model.ruleCollection().get(0).destination()); + Assertions.assertEquals("ctymoxoftp", model.ruleCollection().get(0).ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointResourceInnerTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointResourceInnerTests.java new file mode 100644 index 000000000000..998dedb96e22 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointResourceInnerTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.fluent.models.EnclaveEndpointResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveEndpointResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveEndpointResourceInner model = BinaryData.fromString( + "{\"properties\":{\"ruleCollection\":[{\"protocols\":[\"ICMP\",\"ESP\",\"TCP\"],\"endpointRuleName\":\"epttwqmsniff\",\"destination\":\"mqnrojlpijnkr\",\"ports\":\"rddh\"},{\"protocols\":[\"ESP\"],\"endpointRuleName\":\"zzronasx\",\"destination\":\"tozqyzhftwesgo\",\"ports\":\"zhonnxkrlgnyhmo\"},{\"protocols\":[\"AH\"],\"endpointRuleName\":\"gthrrghxjbdhq\",\"destination\":\"cx\",\"ports\":\"rpdsof\"},{\"protocols\":[\"TCP\",\"AH\"],\"endpointRuleName\":\"vbuswd\",\"destination\":\"yybyc\",\"ports\":\"nvjsrtkfa\"}],\"resourceCollection\":[\"pqgik\",\"zirtxdyuxzejntps\",\"wgioilqukry\",\"xtqmieoxor\"],\"provisioningState\":\"Creating\"},\"location\":\"hyaomtbghhavgr\",\"tags\":{\"jzhpjbibgjmfx\":\"fo\",\"cluyovwxnbkf\":\"mv\",\"zbomvzzbtdcqvpni\":\"zzxscyhwzdgiruj\"},\"id\":\"ujviylwdshfs\",\"name\":\"n\",\"type\":\"bgye\"}") + .toObject(EnclaveEndpointResourceInner.class); + Assertions.assertEquals("hyaomtbghhavgr", model.location()); + Assertions.assertEquals("fo", model.tags().get("jzhpjbibgjmfx")); + Assertions.assertEquals(EnclaveEndpointProtocol.ICMP, + model.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("epttwqmsniff", model.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("mqnrojlpijnkr", model.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("rddh", model.properties().ruleCollection().get(0).ports()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnclaveEndpointResourceInner model = new EnclaveEndpointResourceInner().withLocation("hyaomtbghhavgr") + .withTags(mapOf("jzhpjbibgjmfx", "fo", "cluyovwxnbkf", "mv", "zbomvzzbtdcqvpni", "zzxscyhwzdgiruj")) + .withProperties(new EnclaveEndpointProperties().withRuleCollection(Arrays.asList( + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.ICMP, EnclaveEndpointProtocol.ESP, + EnclaveEndpointProtocol.TCP)) + .withEndpointRuleName("epttwqmsniff") + .withDestination("mqnrojlpijnkr") + .withPorts("rddh"), + new EnclaveEndpointDestinationRule().withProtocols(Arrays.asList(EnclaveEndpointProtocol.ESP)) + .withEndpointRuleName("zzronasx") + .withDestination("tozqyzhftwesgo") + .withPorts("zhonnxkrlgnyhmo"), + new EnclaveEndpointDestinationRule().withProtocols(Arrays.asList(EnclaveEndpointProtocol.AH)) + .withEndpointRuleName("gthrrghxjbdhq") + .withDestination("cx") + .withPorts("rpdsof"), + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP, EnclaveEndpointProtocol.AH)) + .withEndpointRuleName("vbuswd") + .withDestination("yybyc") + .withPorts("nvjsrtkfa")))); + model = BinaryData.fromObject(model).toObject(EnclaveEndpointResourceInner.class); + Assertions.assertEquals("hyaomtbghhavgr", model.location()); + Assertions.assertEquals("fo", model.tags().get("jzhpjbibgjmfx")); + Assertions.assertEquals(EnclaveEndpointProtocol.ICMP, + model.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("epttwqmsniff", model.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("mqnrojlpijnkr", model.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("rddh", model.properties().ruleCollection().get(0).ports()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointResourceListResultTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointResourceListResultTests.java new file mode 100644 index 000000000000..6f0f24ec6984 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointResourceListResultTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.implementation.models.EnclaveEndpointResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveEndpointResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveEndpointResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"ruleCollection\":[{\"protocols\":[\"TCP\",\"AH\",\"ESP\",\"ICMP\"],\"endpointRuleName\":\"cvhzlhp\",\"destination\":\"dqkdlwwqfbu\",\"ports\":\"kxtrq\"},{\"protocols\":[\"UDP\",\"ANY\",\"ICMP\",\"ESP\"],\"endpointRuleName\":\"xhwgfwsrtaw\",\"destination\":\"ezbrhubskh\",\"ports\":\"ygo\"}],\"resourceCollection\":[\"kqfqjbvl\",\"orfmluiqt\",\"zf\"],\"provisioningState\":\"Running\"},\"location\":\"nqqyba\",\"tags\":{\"qgzsles\":\"uayjkqa\",\"vbquwr\":\"cbhernntiewdj\",\"uffkmrqemvvh\":\"ehwagoh\",\"futacoebjvewzc\":\"xtdr\"},\"id\":\"znmwcp\",\"name\":\"guaadraufactkahz\",\"type\":\"v\"},{\"properties\":{\"ruleCollection\":[{\"protocols\":[\"ESP\",\"UDP\",\"AH\",\"AH\"],\"endpointRuleName\":\"hneekul\",\"destination\":\"slqubkwdl\",\"ports\":\"rds\"}],\"resourceCollection\":[\"jbazpjuohminy\",\"lnorwmdu\",\"wpklvxw\",\"ygdxpgpqchis\"],\"provisioningState\":\"Succeeded\"},\"location\":\"nb\",\"tags\":{\"confozauors\":\"xgibbda\",\"epzl\":\"kokwbqplhlvnu\"},\"id\":\"phwzsoldweyuqdu\",\"name\":\"vmnnrw\",\"type\":\"biorktal\"},{\"properties\":{\"ruleCollection\":[{\"protocols\":[\"AH\",\"ANY\",\"ICMP\"],\"endpointRuleName\":\"xmsivfomiloxggdu\",\"destination\":\"q\",\"ports\":\"ieuzaofjchvcyyy\"},{\"protocols\":[\"ESP\",\"ICMP\",\"ESP\",\"AH\"],\"endpointRuleName\":\"biipuip\",\"destination\":\"qonmacj\",\"ports\":\"nizshqvcim\"},{\"protocols\":[\"TCP\",\"ICMP\",\"UDP\"],\"endpointRuleName\":\"lrri\",\"destination\":\"ywdxsmic\",\"ports\":\"rwfscjfnynszquj\"}],\"resourceCollection\":[\"voqyt\",\"byowbblgyavutp\"],\"provisioningState\":\"Updating\"},\"location\":\"xoi\",\"tags\":{\"cgxxlxs\":\"ksbpimlqoljx\"},\"id\":\"fgcviz\",\"name\":\"zdwlvwlyoupfgfb\",\"type\":\"jub\"},{\"properties\":{\"ruleCollection\":[{\"protocols\":[\"UDP\"],\"endpointRuleName\":\"in\",\"destination\":\"owzfttsttkt\",\"ports\":\"hbq\"},{\"protocols\":[\"AH\"],\"endpointRuleName\":\"gzukxitmm\",\"destination\":\"gqqqxh\",\"ports\":\"xrxc\"}],\"resourceCollection\":[\"isavok\",\"dzf\"],\"provisioningState\":\"Canceled\"},\"location\":\"vjlfrqtt\",\"tags\":{\"kuvscxkdm\":\"lkatnwxyiopidkqq\",\"rxkpmloazuruoc\":\"igovi\",\"bfhjxakvvjgsl\":\"goorbteo\"},\"id\":\"r\",\"name\":\"il\",\"type\":\"yw\"}],\"nextLink\":\"kgkxn\"}") + .toObject(EnclaveEndpointResourceListResult.class); + Assertions.assertEquals("nqqyba", model.value().get(0).location()); + Assertions.assertEquals("uayjkqa", model.value().get(0).tags().get("qgzsles")); + Assertions.assertEquals(EnclaveEndpointProtocol.TCP, + model.value().get(0).properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("cvhzlhp", + model.value().get(0).properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("dqkdlwwqfbu", model.value().get(0).properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("kxtrq", model.value().get(0).properties().ruleCollection().get(0).ports()); + Assertions.assertEquals("kgkxn", model.nextLink()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsCreateOrUpdateMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..6f330efeb699 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsCreateOrUpdateMockTests.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProperties; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveEndpointsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"ruleCollection\":[{\"protocols\":[\"ICMP\",\"TCP\",\"ANY\",\"ANY\"],\"endpointRuleName\":\"aqbzgyhfwwvuatbw\",\"destination\":\"amteuliyslpkc\",\"ports\":\"w\"},{\"protocols\":[\"ANY\"],\"endpointRuleName\":\"epmywbormcqm\",\"destination\":\"iijq\",\"ports\":\"zfboj\"},{\"protocols\":[\"UDP\",\"ESP\",\"UDP\"],\"endpointRuleName\":\"qwixvcpwnk\",\"destination\":\"wzwofalickduo\",\"ports\":\"tamtyv\"},{\"protocols\":[\"ICMP\",\"TCP\",\"TCP\"],\"endpointRuleName\":\"awnvsbcfhza\",\"destination\":\"nvhycvdimwrz\",\"ports\":\"gzgy\"}],\"resourceCollection\":[\"trwpw\",\"ryekzkd\",\"meottawj\"],\"provisioningState\":\"Succeeded\"},\"location\":\"wwhnhjtfvpn\",\"tags\":{\"jpnwynudql\":\"i\",\"lxeehuxiq\":\"zsauzp\",\"xls\":\"zlrayme\"},\"id\":\"ihmxrfdsajredn\",\"name\":\"yyshtuwgmevua\",\"type\":\"pwzyi\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + EnclaveEndpointResource response = manager.enclaveEndpoints() + .define("yeji") + .withRegion("v") + .withExistingVirtualEnclave("vbiztjofqcv", "vjufycsjmlbe") + .withTags(mapOf("uazjcgmxitpfinz", "goaqylkjztj", "mtbdrvcqgu", "pdltkrlg", "urelyujlfyoump", "fzhompheq", + "brzmqxucycijoclx", "kyeclcdigpta")) + .withProperties(new EnclaveEndpointProperties().withRuleCollection(Arrays.asList( + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.UDP, EnclaveEndpointProtocol.ESP, + EnclaveEndpointProtocol.ICMP)) + .withEndpointRuleName("rtudawlpjfel") + .withDestination("rpptcbgqnzmnhiil") + .withPorts("lwcjgckbbcccgzpr"), + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.AH, EnclaveEndpointProtocol.ICMP, + EnclaveEndpointProtocol.ESP, EnclaveEndpointProtocol.ESP)) + .withEndpointRuleName("a") + .withDestination("gftipwc") + .withPorts("yubhiqdx"), + new EnclaveEndpointDestinationRule() + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.AH, EnclaveEndpointProtocol.ICMP, + EnclaveEndpointProtocol.ICMP, EnclaveEndpointProtocol.AH)) + .withEndpointRuleName("zafccnuhiigb") + .withDestination("bui") + .withPorts("xvatvcr"), + new EnclaveEndpointDestinationRule().withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP)) + .withEndpointRuleName("bqxvhcsyhzlwxae") + .withDestination("vurex") + .withPorts("d")))) + .create(); + + Assertions.assertEquals("wwhnhjtfvpn", response.location()); + Assertions.assertEquals("i", response.tags().get("jpnwynudql")); + Assertions.assertEquals(EnclaveEndpointProtocol.ICMP, + response.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("aqbzgyhfwwvuatbw", response.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("amteuliyslpkc", response.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("w", response.properties().ruleCollection().get(0).ports()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsGetWithResponseMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsGetWithResponseMockTests.java new file mode 100644 index 000000000000..a881e08b0e79 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsGetWithResponseMockTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveEndpointsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"ruleCollection\":[{\"protocols\":[\"ICMP\",\"UDP\",\"UDP\"],\"endpointRuleName\":\"rvvmqfloygb\",\"destination\":\"wumgx\",\"ports\":\"dhp\"},{\"protocols\":[\"ESP\",\"TCP\"],\"endpointRuleName\":\"jddvjsaqw\",\"destination\":\"mmwllc\",\"ports\":\"srsxaptefh\"},{\"protocols\":[\"ESP\",\"UDP\",\"ICMP\",\"ANY\"],\"endpointRuleName\":\"ljnhvlqj\",\"destination\":\"kpeeksnbksdqhj\",\"ports\":\"klxesl\"},{\"protocols\":[\"ICMP\",\"ANY\",\"ANY\",\"ICMP\"],\"endpointRuleName\":\"oqmavnwqjwgo\",\"destination\":\"lejjjkxy\",\"ports\":\"fdb\"}],\"resourceCollection\":[\"ztensvkzykjtj\",\"nsxfwu\",\"hcdpkupnqrmgj\",\"bpkuwxeoio\"],\"provisioningState\":\"Updating\"},\"location\":\"fa\",\"tags\":{\"fwxrzxmdew\":\"zwfbcyaykmmfzs\",\"lbjazejww\":\"rsxkr\"},\"id\":\"iyoypsuhbrnnhj\",\"name\":\"sqwjhqkbiwetpozy\",\"type\":\"yqiq\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + EnclaveEndpointResource response = manager.enclaveEndpoints() + .getWithResponse("syeipqd", "mjtgrqg", "gkkileplkcsmkn", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("fa", response.location()); + Assertions.assertEquals("zwfbcyaykmmfzs", response.tags().get("fwxrzxmdew")); + Assertions.assertEquals(EnclaveEndpointProtocol.ICMP, + response.properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("rvvmqfloygb", response.properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("wumgx", response.properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("dhp", response.properties().ruleCollection().get(0).ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalCreationMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalCreationMockTests.java new file mode 100644 index 000000000000..d4ff7c3780e9 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalCreationMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveEndpointsHandleApprovalCreationMockTests { + @Test + public void testHandleApprovalCreation() throws Exception { + String responseStr = "{\"message\":\"z\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ApprovalActionResponse response = manager.enclaveEndpoints() + .handleApprovalCreation("coqra", "wugyx", "qi", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.REJECTED) + .withApprovalCallbackPayload("alwvskbu"), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("z", response.message()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalDeletionMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalDeletionMockTests.java new file mode 100644 index 000000000000..b029c0acc0ad --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsHandleApprovalDeletionMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveEndpointsHandleApprovalDeletionMockTests { + @Test + public void testHandleApprovalDeletion() throws Exception { + String responseStr = "{\"message\":\"akuejk\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ApprovalActionResponse response = manager.enclaveEndpoints() + .handleApprovalDeletion("caqt", "ltcoqc", "jpds", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.DELETE), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("akuejk", response.message()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListByEnclaveResourceMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListByEnclaveResourceMockTests.java new file mode 100644 index 000000000000..ff52ecde1306 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListByEnclaveResourceMockTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveEndpointsListByEnclaveResourceMockTests { + @Test + public void testListByEnclaveResource() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"ruleCollection\":[{\"protocols\":[\"ESP\",\"ICMP\"],\"endpointRuleName\":\"kkdtnhqsy\",\"destination\":\"jselpkpbafvafh\",\"ports\":\"ylcc\"},{\"protocols\":[\"AH\"],\"endpointRuleName\":\"hyzdfwrs\",\"destination\":\"pl\",\"ports\":\"bmairrhvhfnracwn\"},{\"protocols\":[\"ESP\",\"ANY\"],\"endpointRuleName\":\"ujwouhdawsi\",\"destination\":\"bjb\",\"ports\":\"jybvit\"},{\"protocols\":[\"ESP\",\"ICMP\",\"ESP\"],\"endpointRuleName\":\"nu\",\"destination\":\"ggmuwdcho\",\"ports\":\"nkf\"}],\"resourceCollection\":[\"v\"],\"provisioningState\":\"Canceled\"},\"location\":\"kizvoa\",\"tags\":{\"lnuwiguy\":\"a\",\"wxh\":\"lykwphvxz\"},\"id\":\"pejtl\",\"name\":\"exaonwivkcq\",\"type\":\"rxhxkn\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.enclaveEndpoints() + .listByEnclaveResource("hgf", "etzlexbsfledynoj", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("kizvoa", response.iterator().next().location()); + Assertions.assertEquals("a", response.iterator().next().tags().get("lnuwiguy")); + Assertions.assertEquals(EnclaveEndpointProtocol.ESP, + response.iterator().next().properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("kkdtnhqsy", + response.iterator().next().properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("jselpkpbafvafh", + response.iterator().next().properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("ylcc", response.iterator().next().properties().ruleCollection().get(0).ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListBySubscriptionMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListBySubscriptionMockTests.java new file mode 100644 index 000000000000..4597bf8b56b3 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveEndpointsListBySubscriptionMockTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointProtocol; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveEndpointResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class EnclaveEndpointsListBySubscriptionMockTests { + @Test + public void testListBySubscription() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"ruleCollection\":[{\"protocols\":[\"ICMP\",\"ESP\",\"AH\"],\"endpointRuleName\":\"jfkakfqfrke\",\"destination\":\"il\",\"ports\":\"dxjascowvfdj\"},{\"protocols\":[\"ICMP\",\"TCP\"],\"endpointRuleName\":\"lkksnmgzvyfi\",\"destination\":\"kzuqnwsith\",\"ports\":\"olyahluqwqulsut\"}],\"resourceCollection\":[\"hxykfhyqez\",\"qqug\",\"rftb\",\"ve\"],\"provisioningState\":\"Canceled\"},\"location\":\"quowtljvfwhrea\",\"tags\":{\"dgglmepjpfs\":\"yxvrqtvbczsul\",\"fpgylkve\":\"ykgsangpszng\"},\"id\":\"jujcngoad\",\"name\":\"edmzrgjfoknub\",\"type\":\"oitpkpztrgdgx\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.enclaveEndpoints().listBySubscription("ccrmmk", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("quowtljvfwhrea", response.iterator().next().location()); + Assertions.assertEquals("yxvrqtvbczsul", response.iterator().next().tags().get("dgglmepjpfs")); + Assertions.assertEquals(EnclaveEndpointProtocol.ICMP, + response.iterator().next().properties().ruleCollection().get(0).protocols().get(0)); + Assertions.assertEquals("jfkakfqfrke", + response.iterator().next().properties().ruleCollection().get(0).endpointRuleName()); + Assertions.assertEquals("il", response.iterator().next().properties().ruleCollection().get(0).destination()); + Assertions.assertEquals("dxjascowvfdj", + response.iterator().next().properties().ruleCollection().get(0).ports()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveVirtualNetworkModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveVirtualNetworkModelTests.java new file mode 100644 index 000000000000..16cd12c0b9ba --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/EnclaveVirtualNetworkModelTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class EnclaveVirtualNetworkModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + EnclaveVirtualNetworkModel model = BinaryData.fromString( + "{\"networkName\":\"jdyggdtji\",\"networkSize\":\"b\",\"customCidrRange\":\"ofqweykhmenevfye\",\"subnetConfigurations\":[{\"subnetName\":\"hybcibv\",\"subnetResourceId\":\"dcsi\",\"networkPrefixSize\":1451837179,\"subnetDelegation\":\"naamde\",\"addressPrefix\":\"eh\",\"networkSecurityGroupResourceId\":\"qsc\"},{\"subnetName\":\"eypvhezrkg\",\"subnetResourceId\":\"c\",\"networkPrefixSize\":1889311419,\"subnetDelegation\":\"fovgmkqsleyyvxy\",\"addressPrefix\":\"pkc\",\"networkSecurityGroupResourceId\":\"tpngjcrcczsqpjh\"}],\"allowSubnetCommunication\":false}") + .toObject(EnclaveVirtualNetworkModel.class); + Assertions.assertEquals("jdyggdtji", model.networkName()); + Assertions.assertEquals("b", model.networkSize()); + Assertions.assertEquals("ofqweykhmenevfye", model.customCidrRange()); + Assertions.assertEquals("hybcibv", model.subnetConfigurations().get(0).subnetName()); + Assertions.assertEquals(1451837179, model.subnetConfigurations().get(0).networkPrefixSize()); + Assertions.assertEquals("naamde", model.subnetConfigurations().get(0).subnetDelegation()); + Assertions.assertFalse(model.allowSubnetCommunication()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + EnclaveVirtualNetworkModel model = new EnclaveVirtualNetworkModel().withNetworkName("jdyggdtji") + .withNetworkSize("b") + .withCustomCidrRange("ofqweykhmenevfye") + .withSubnetConfigurations(Arrays.asList( + new SubnetConfiguration().withSubnetName("hybcibv") + .withNetworkPrefixSize(1451837179) + .withSubnetDelegation("naamde"), + new SubnetConfiguration().withSubnetName("eypvhezrkg") + .withNetworkPrefixSize(1889311419) + .withSubnetDelegation("fovgmkqsleyyvxy"))) + .withAllowSubnetCommunication(false); + model = BinaryData.fromObject(model).toObject(EnclaveVirtualNetworkModel.class); + Assertions.assertEquals("jdyggdtji", model.networkName()); + Assertions.assertEquals("b", model.networkSize()); + Assertions.assertEquals("ofqweykhmenevfye", model.customCidrRange()); + Assertions.assertEquals("hybcibv", model.subnetConfigurations().get(0).subnetName()); + Assertions.assertEquals(1451837179, model.subnetConfigurations().get(0).networkPrefixSize()); + Assertions.assertEquals("naamde", model.subnetConfigurations().get(0).subnetDelegation()); + Assertions.assertFalse(model.allowSubnetCommunication()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/GovernedServiceItemTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/GovernedServiceItemTests.java new file mode 100644 index 000000000000..4b1a2710c564 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/GovernedServiceItemTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import org.junit.jupiter.api.Assertions; + +public final class GovernedServiceItemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GovernedServiceItem model = BinaryData.fromString( + "{\"serviceId\":\"DataConnectors\",\"serviceName\":\"ureximoryocfs\",\"option\":\"Allow\",\"enforcement\":\"Disabled\",\"policyAction\":\"Enforce\",\"initiatives\":[\"tki\",\"uxh\",\"yudxorrqnbp\"]}") + .toObject(GovernedServiceItem.class); + Assertions.assertEquals(ServiceIdentifier.DATA_CONNECTORS, model.serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.ALLOW, model.option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.DISABLED, model.enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.ENFORCE, model.policyAction()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GovernedServiceItem model = new GovernedServiceItem().withServiceId(ServiceIdentifier.DATA_CONNECTORS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.ENFORCE); + model = BinaryData.fromObject(model).toObject(GovernedServiceItem.class); + Assertions.assertEquals(ServiceIdentifier.DATA_CONNECTORS, model.serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.ALLOW, model.option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.DISABLED, model.enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.ENFORCE, model.policyAction()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MaintenanceModeConfigurationModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MaintenanceModeConfigurationModelTests.java new file mode 100644 index 000000000000..7dc591aed279 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MaintenanceModeConfigurationModelTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModel; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MaintenanceModeConfigurationModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MaintenanceModeConfigurationModel model = BinaryData.fromString( + "{\"mode\":\"On\",\"principals\":[{\"id\":\"mvvd\",\"type\":\"User\"}],\"justification\":\"Governance\"}") + .toObject(MaintenanceModeConfigurationModel.class); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.ON, model.mode()); + Assertions.assertEquals("mvvd", model.principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.GOVERNANCE, model.justification()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MaintenanceModeConfigurationModel model + = new MaintenanceModeConfigurationModel().withMode(MaintenanceModeConfigurationModelMode.ON) + .withPrincipals(Arrays.asList(new Principal().withId("mvvd").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationModelJustification.GOVERNANCE); + model = BinaryData.fromObject(model).toObject(MaintenanceModeConfigurationModel.class); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.ON, model.mode()); + Assertions.assertEquals("mvvd", model.principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.GOVERNANCE, model.justification()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MaintenanceModeConfigurationPatchModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MaintenanceModeConfigurationPatchModelTests.java new file mode 100644 index 000000000000..3755e3a0d6f3 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MaintenanceModeConfigurationPatchModelTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MaintenanceModeConfigurationPatchModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MaintenanceModeConfigurationPatchModel model = BinaryData.fromString( + "{\"mode\":\"On\",\"principals\":[{\"id\":\"kuwbcrnwb\",\"type\":\"User\"},{\"id\":\"hhseyv\",\"type\":\"Group\"},{\"id\":\"srtslhspkdeem\",\"type\":\"ServicePrincipal\"},{\"id\":\"fm\",\"type\":\"ServicePrincipal\"}],\"justification\":\"Networking\"}") + .toObject(MaintenanceModeConfigurationPatchModel.class); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.ON, model.mode()); + Assertions.assertEquals("kuwbcrnwb", model.principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.NETWORKING, model.justification()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MaintenanceModeConfigurationPatchModel model + = new MaintenanceModeConfigurationPatchModel().withMode(MaintenanceModeConfigurationModelMode.ON) + .withPrincipals(Arrays.asList(new Principal().withId("kuwbcrnwb").withType(PrincipalType.USER), + new Principal().withId("hhseyv").withType(PrincipalType.GROUP), + new Principal().withId("srtslhspkdeem").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("fm").withType(PrincipalType.SERVICE_PRINCIPAL))) + .withJustification(MaintenanceModeConfigurationModelJustification.NETWORKING); + model = BinaryData.fromObject(model).toObject(MaintenanceModeConfigurationPatchModel.class); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.ON, model.mode()); + Assertions.assertEquals("kuwbcrnwb", model.principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.NETWORKING, model.justification()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ManagedOnBehalfOfConfigurationTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ManagedOnBehalfOfConfigurationTests.java new file mode 100644 index 000000000000..c5a576b94df8 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ManagedOnBehalfOfConfigurationTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ManagedOnBehalfOfConfiguration; + +public final class ManagedOnBehalfOfConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedOnBehalfOfConfiguration model = BinaryData + .fromString( + "{\"moboBrokerResources\":[{\"id\":\"jozkrwfndiod\"},{\"id\":\"slwejdpvw\"},{\"id\":\"oqpsoa\"}]}") + .toObject(ManagedOnBehalfOfConfiguration.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ManagedServiceIdentityTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ManagedServiceIdentityTests.java new file mode 100644 index 000000000000..a1c09a1987c6 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = BinaryData.fromString( + "{\"principalId\":\"pnpulexxbczwtru\",\"tenantId\":\"qzbqjvsov\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"wwzjuqkhrsajiwku\":{\"principalId\":\"cspkwlhzdobpxjmf\",\"clientId\":\"vvnchrkcc\"},\"mjmvxieduugidyjr\":{\"principalId\":\"oskg\",\"clientId\":\"auu\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf("wwzjuqkhrsajiwku", new UserAssignedIdentity(), "mjmvxieduugidyjr", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MandatoryApproverTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MandatoryApproverTests.java new file mode 100644 index 000000000000..6d9938d6e76d --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MandatoryApproverTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.MandatoryApprover; +import org.junit.jupiter.api.Assertions; + +public final class MandatoryApproverTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MandatoryApprover model + = BinaryData.fromString("{\"approverEntraId\":\"jxywsuws\"}").toObject(MandatoryApprover.class); + Assertions.assertEquals("jxywsuws", model.approverEntraId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MandatoryApprover model = new MandatoryApprover().withApproverEntraId("jxywsuws"); + model = BinaryData.fromObject(model).toObject(MandatoryApprover.class); + Assertions.assertEquals("jxywsuws", model.approverEntraId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MoboBrokerResourceTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MoboBrokerResourceTests.java new file mode 100644 index 000000000000..71ab7f64b871 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/MoboBrokerResourceTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.MoboBrokerResource; +import org.junit.jupiter.api.Assertions; + +public final class MoboBrokerResourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MoboBrokerResource model = BinaryData.fromString("{\"id\":\"tazak\"}").toObject(MoboBrokerResource.class); + Assertions.assertEquals("tazak", model.id()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationDisplayTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..8588f1d052ff --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationDisplayTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationInnerTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationInnerTests.java new file mode 100644 index 000000000000..bd854c35818d --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.fluent.models.OperationInner; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationListResultTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationListResultTests.java new file mode 100644 index 000000000000..8b72380b5342 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.implementation.models.OperationListResult; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("kfo", model.nextLink()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationsListMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..12fbd7061dcd --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/OperationsListMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"meqwig\",\"isDataAction\":false,\"display\":{\"provider\":\"qwyxebeybpm\",\"resource\":\"nrtffyaqi\",\"operation\":\"hheioqaqhvseuf\",\"description\":\"yrxpdlcgqls\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/PrincipalTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/PrincipalTests.java new file mode 100644 index 000000000000..0d9114b6a488 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/PrincipalTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import org.junit.jupiter.api.Assertions; + +public final class PrincipalTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Principal model + = BinaryData.fromString("{\"id\":\"q\",\"type\":\"ServicePrincipal\"}").toObject(Principal.class); + Assertions.assertEquals("q", model.id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Principal model = new Principal().withId("q").withType(PrincipalType.SERVICE_PRINCIPAL); + model = BinaryData.fromObject(model).toObject(Principal.class); + Assertions.assertEquals("q", model.id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, model.type()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/RequestMetadataTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/RequestMetadataTests.java new file mode 100644 index 000000000000..83f995d2b9d2 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/RequestMetadataTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.RequestMetadata; +import org.junit.jupiter.api.Assertions; + +public final class RequestMetadataTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RequestMetadata model = BinaryData.fromString( + "{\"resourceAction\":\"xvxevblbjednljla\",\"approvalCallbackRoute\":\"uaulxunsm\",\"approvalCallbackPayload\":\"nkppxynen\",\"approvalStatus\":\"Rejected\"}") + .toObject(RequestMetadata.class); + Assertions.assertEquals("xvxevblbjednljla", model.resourceAction()); + Assertions.assertEquals("uaulxunsm", model.approvalCallbackRoute()); + Assertions.assertEquals("nkppxynen", model.approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.REJECTED, model.approvalStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RequestMetadata model = new RequestMetadata().withResourceAction("xvxevblbjednljla") + .withApprovalCallbackRoute("uaulxunsm") + .withApprovalCallbackPayload("nkppxynen") + .withApprovalStatus(ApprovalStatus.REJECTED); + model = BinaryData.fromObject(model).toObject(RequestMetadata.class); + Assertions.assertEquals("xvxevblbjednljla", model.resourceAction()); + Assertions.assertEquals("uaulxunsm", model.approvalCallbackRoute()); + Assertions.assertEquals("nkppxynen", model.approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.REJECTED, model.approvalStatus()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/RequestMetadataUpdatablePropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/RequestMetadataUpdatablePropertiesTests.java new file mode 100644 index 000000000000..a2b96ea7297a --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/RequestMetadataUpdatablePropertiesTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.RequestMetadataUpdatableProperties; +import org.junit.jupiter.api.Assertions; + +public final class RequestMetadataUpdatablePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RequestMetadataUpdatableProperties model = BinaryData.fromString( + "{\"resourceAction\":\"ddtvqctt\",\"approvalCallbackRoute\":\"ijaeukm\",\"approvalCallbackPayload\":\"ieekpndzaa\",\"approvalStatus\":\"Deleted\"}") + .toObject(RequestMetadataUpdatableProperties.class); + Assertions.assertEquals("ddtvqctt", model.resourceAction()); + Assertions.assertEquals("ijaeukm", model.approvalCallbackRoute()); + Assertions.assertEquals("ieekpndzaa", model.approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.DELETED, model.approvalStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RequestMetadataUpdatableProperties model + = new RequestMetadataUpdatableProperties().withResourceAction("ddtvqctt") + .withApprovalCallbackRoute("ijaeukm") + .withApprovalCallbackPayload("ieekpndzaa") + .withApprovalStatus(ApprovalStatus.DELETED); + model = BinaryData.fromObject(model).toObject(RequestMetadataUpdatableProperties.class); + Assertions.assertEquals("ddtvqctt", model.resourceAction()); + Assertions.assertEquals("ijaeukm", model.approvalCallbackRoute()); + Assertions.assertEquals("ieekpndzaa", model.approvalCallbackPayload()); + Assertions.assertEquals(ApprovalStatus.DELETED, model.approvalStatus()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/RoleAssignmentItemTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/RoleAssignmentItemTests.java new file mode 100644 index 000000000000..85acb773c624 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/RoleAssignmentItemTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RoleAssignmentItemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RoleAssignmentItem model = BinaryData + .fromString("{\"roleDefinitionId\":\"ktwh\",\"principals\":[{\"id\":\"wz\",\"type\":\"Group\"}]}") + .toObject(RoleAssignmentItem.class); + Assertions.assertEquals("ktwh", model.roleDefinitionId()); + Assertions.assertEquals("wz", model.principals().get(0).id()); + Assertions.assertEquals(PrincipalType.GROUP, model.principals().get(0).type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RoleAssignmentItem model = new RoleAssignmentItem().withRoleDefinitionId("ktwh") + .withPrincipals(Arrays.asList(new Principal().withId("wz").withType(PrincipalType.GROUP))); + model = BinaryData.fromObject(model).toObject(RoleAssignmentItem.class); + Assertions.assertEquals("ktwh", model.roleDefinitionId()); + Assertions.assertEquals("wz", model.principals().get(0).id()); + Assertions.assertEquals(PrincipalType.GROUP, model.principals().get(0).type()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/SubnetConfigurationTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/SubnetConfigurationTests.java new file mode 100644 index 000000000000..5f3392b70cff --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/SubnetConfigurationTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import org.junit.jupiter.api.Assertions; + +public final class SubnetConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubnetConfiguration model = BinaryData.fromString( + "{\"subnetName\":\"ajvnysounqe\",\"subnetResourceId\":\"noae\",\"networkPrefixSize\":1344764188,\"subnetDelegation\":\"hy\",\"addressPrefix\":\"trpmo\",\"networkSecurityGroupResourceId\":\"mcmatuokthfuiu\"}") + .toObject(SubnetConfiguration.class); + Assertions.assertEquals("ajvnysounqe", model.subnetName()); + Assertions.assertEquals(1344764188, model.networkPrefixSize()); + Assertions.assertEquals("hy", model.subnetDelegation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubnetConfiguration model = new SubnetConfiguration().withSubnetName("ajvnysounqe") + .withNetworkPrefixSize(1344764188) + .withSubnetDelegation("hy"); + model = BinaryData.fromObject(model).toObject(SubnetConfiguration.class); + Assertions.assertEquals("ajvnysounqe", model.subnetName()); + Assertions.assertEquals(1344764188, model.networkPrefixSize()); + Assertions.assertEquals("hy", model.subnetDelegation()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubPatchModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubPatchModelTests.java new file mode 100644 index 000000000000..4c96b3528e78 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubPatchModelTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOption; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TransitHubPatchModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TransitHubPatchModel model = BinaryData.fromString( + "{\"properties\":{\"state\":\"Failed\",\"transitOption\":{\"type\":\"Gateway\",\"params\":{\"scaleUnits\":1576593550947167989,\"remoteVirtualNetworkId\":\"zimejzanlfzx\"}}},\"tags\":{\"okixrjqcir\":\"rmbzo\",\"szrnwo\":\"zpfrla\"}}") + .toObject(TransitHubPatchModel.class); + Assertions.assertEquals(TransitHubState.FAILED, model.properties().state()); + Assertions.assertEquals(TransitOptionType.GATEWAY, model.properties().transitOption().type()); + Assertions.assertEquals(1576593550947167989L, model.properties().transitOption().params().scaleUnits()); + Assertions.assertEquals("zimejzanlfzx", model.properties().transitOption().params().remoteVirtualNetworkId()); + Assertions.assertEquals("rmbzo", model.tags().get("okixrjqcir")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TransitHubPatchModel model = new TransitHubPatchModel() + .withProperties(new TransitHubPatchProperties().withState(TransitHubState.FAILED) + .withTransitOption(new TransitOption().withType(TransitOptionType.GATEWAY) + .withParams(new TransitOptionParams().withScaleUnits(1576593550947167989L) + .withRemoteVirtualNetworkId("zimejzanlfzx")))) + .withTags(mapOf("okixrjqcir", "rmbzo", "szrnwo", "zpfrla")); + model = BinaryData.fromObject(model).toObject(TransitHubPatchModel.class); + Assertions.assertEquals(TransitHubState.FAILED, model.properties().state()); + Assertions.assertEquals(TransitOptionType.GATEWAY, model.properties().transitOption().type()); + Assertions.assertEquals(1576593550947167989L, model.properties().transitOption().params().scaleUnits()); + Assertions.assertEquals("zimejzanlfzx", model.properties().transitOption().params().remoteVirtualNetworkId()); + Assertions.assertEquals("rmbzo", model.tags().get("okixrjqcir")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubPatchPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubPatchPropertiesTests.java new file mode 100644 index 000000000000..1df74f24bbae --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubPatchPropertiesTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubPatchProperties; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOption; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import org.junit.jupiter.api.Assertions; + +public final class TransitHubPatchPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TransitHubPatchProperties model = BinaryData.fromString( + "{\"state\":\"PendingUpdate\",\"transitOption\":{\"type\":\"Peering\",\"params\":{\"scaleUnits\":4045601352916026430,\"remoteVirtualNetworkId\":\"wbtlhflsjcdh\"}}}") + .toObject(TransitHubPatchProperties.class); + Assertions.assertEquals(TransitHubState.PENDING_UPDATE, model.state()); + Assertions.assertEquals(TransitOptionType.PEERING, model.transitOption().type()); + Assertions.assertEquals(4045601352916026430L, model.transitOption().params().scaleUnits()); + Assertions.assertEquals("wbtlhflsjcdh", model.transitOption().params().remoteVirtualNetworkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TransitHubPatchProperties model = new TransitHubPatchProperties().withState(TransitHubState.PENDING_UPDATE) + .withTransitOption(new TransitOption().withType(TransitOptionType.PEERING) + .withParams(new TransitOptionParams().withScaleUnits(4045601352916026430L) + .withRemoteVirtualNetworkId("wbtlhflsjcdh"))); + model = BinaryData.fromObject(model).toObject(TransitHubPatchProperties.class); + Assertions.assertEquals(TransitHubState.PENDING_UPDATE, model.state()); + Assertions.assertEquals(TransitOptionType.PEERING, model.transitOption().type()); + Assertions.assertEquals(4045601352916026430L, model.transitOption().params().scaleUnits()); + Assertions.assertEquals("wbtlhflsjcdh", model.transitOption().params().remoteVirtualNetworkId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubPropertiesTests.java new file mode 100644 index 000000000000..4de69d9c5c34 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubPropertiesTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubProperties; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOption; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import org.junit.jupiter.api.Assertions; + +public final class TransitHubPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TransitHubProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Canceled\",\"state\":\"Failed\",\"transitOption\":{\"type\":\"Gateway\",\"params\":{\"scaleUnits\":3361403308892839308,\"remoteVirtualNetworkId\":\"hqlbjbsybbq\"}},\"resourceCollection\":[\"t\",\"dgmfpgvmpipasl\",\"haq\",\"x\"]}") + .toObject(TransitHubProperties.class); + Assertions.assertEquals(TransitHubState.FAILED, model.state()); + Assertions.assertEquals(TransitOptionType.GATEWAY, model.transitOption().type()); + Assertions.assertEquals(3361403308892839308L, model.transitOption().params().scaleUnits()); + Assertions.assertEquals("hqlbjbsybbq", model.transitOption().params().remoteVirtualNetworkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TransitHubProperties model = new TransitHubProperties().withState(TransitHubState.FAILED) + .withTransitOption(new TransitOption().withType(TransitOptionType.GATEWAY) + .withParams(new TransitOptionParams().withScaleUnits(3361403308892839308L) + .withRemoteVirtualNetworkId("hqlbjbsybbq"))); + model = BinaryData.fromObject(model).toObject(TransitHubProperties.class); + Assertions.assertEquals(TransitHubState.FAILED, model.state()); + Assertions.assertEquals(TransitOptionType.GATEWAY, model.transitOption().type()); + Assertions.assertEquals(3361403308892839308L, model.transitOption().params().scaleUnits()); + Assertions.assertEquals("hqlbjbsybbq", model.transitOption().params().remoteVirtualNetworkId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubResourceInnerTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubResourceInnerTests.java new file mode 100644 index 000000000000..86a29cf9a1b9 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubResourceInnerTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.fluent.models.TransitHubResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubProperties; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOption; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TransitHubResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TransitHubResourceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Creating\",\"state\":\"PendingUpdate\",\"transitOption\":{\"type\":\"Peering\",\"params\":{\"scaleUnits\":5250086231147283633,\"remoteVirtualNetworkId\":\"lmdjrkvfgbvfvpdb\"}},\"resourceCollection\":[\"cizsjqlhkrribdei\",\"qipqkghvxndz\",\"mkrefajpjorwkq\"]},\"location\":\"hgbijt\",\"tags\":{\"wfsdjpvkvpbj\":\"fxzsjabibsyst\",\"ncj\":\"bkzbzkd\"},\"id\":\"budurgkakmo\",\"name\":\"zhjjklffhmouwq\",\"type\":\"gzrf\"}") + .toObject(TransitHubResourceInner.class); + Assertions.assertEquals("hgbijt", model.location()); + Assertions.assertEquals("fxzsjabibsyst", model.tags().get("wfsdjpvkvpbj")); + Assertions.assertEquals(TransitHubState.PENDING_UPDATE, model.properties().state()); + Assertions.assertEquals(TransitOptionType.PEERING, model.properties().transitOption().type()); + Assertions.assertEquals(5250086231147283633L, model.properties().transitOption().params().scaleUnits()); + Assertions.assertEquals("lmdjrkvfgbvfvpdb", + model.properties().transitOption().params().remoteVirtualNetworkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TransitHubResourceInner model = new TransitHubResourceInner().withLocation("hgbijt") + .withTags(mapOf("wfsdjpvkvpbj", "fxzsjabibsyst", "ncj", "bkzbzkd")) + .withProperties(new TransitHubProperties().withState(TransitHubState.PENDING_UPDATE) + .withTransitOption(new TransitOption().withType(TransitOptionType.PEERING) + .withParams(new TransitOptionParams().withScaleUnits(5250086231147283633L) + .withRemoteVirtualNetworkId("lmdjrkvfgbvfvpdb")))); + model = BinaryData.fromObject(model).toObject(TransitHubResourceInner.class); + Assertions.assertEquals("hgbijt", model.location()); + Assertions.assertEquals("fxzsjabibsyst", model.tags().get("wfsdjpvkvpbj")); + Assertions.assertEquals(TransitHubState.PENDING_UPDATE, model.properties().state()); + Assertions.assertEquals(TransitOptionType.PEERING, model.properties().transitOption().type()); + Assertions.assertEquals(5250086231147283633L, model.properties().transitOption().params().scaleUnits()); + Assertions.assertEquals("lmdjrkvfgbvfvpdb", + model.properties().transitOption().params().remoteVirtualNetworkId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubResourceListResultTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubResourceListResultTests.java new file mode 100644 index 000000000000..2db97e606b27 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubResourceListResultTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.implementation.models.TransitHubResourceListResult; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import org.junit.jupiter.api.Assertions; + +public final class TransitHubResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TransitHubResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"NotSpecified\",\"state\":\"Approved\",\"transitOption\":{\"type\":\"Gateway\",\"params\":{\"scaleUnits\":4051356742453567951,\"remoteVirtualNetworkId\":\"rqmq\"}},\"resourceCollection\":[\"vriiio\",\"nalghfkvtvsexso\",\"ueluqhhahhxvrhmz\"]},\"location\":\"pjgwwspug\",\"tags\":{\"hqxujxukndxdi\":\"qs\"},\"id\":\"rjguufzdmsyqtf\",\"name\":\"hwhbotzingamv\",\"type\":\"phoszqz\"},{\"properties\":{\"provisioningState\":\"Canceled\",\"state\":\"Approved\",\"transitOption\":{\"type\":\"Peering\",\"params\":{\"scaleUnits\":6708248733750385169,\"remoteVirtualNetworkId\":\"wcvtbvkayhmtnvyq\"}},\"resourceCollection\":[\"kzwpcnpw\",\"cjaesgvvs\",\"cyajguqf\"]},\"location\":\"ygz\",\"tags\":{\"xu\":\"nk\",\"dpsqx\":\"emdwzrmuhapfc\"},\"id\":\"vpsvuoymgcce\",\"name\":\"vezrypqlmfeo\",\"type\":\"erqwkyhkobopg\"},{\"properties\":{\"provisioningState\":\"Creating\",\"state\":\"Active\",\"transitOption\":{\"type\":\"Gateway\",\"params\":{\"scaleUnits\":2106784928647085013,\"remoteVirtualNetworkId\":\"kbwcc\"}},\"resourceCollection\":[\"vcdwxlpqekftn\",\"htjsying\",\"fq\"]},\"location\":\"mtdh\",\"tags\":{\"zywkb\":\"vypgikdg\",\"rvqqaatj\":\"rryuzhlhkjo\",\"ioolvrwxkvtkkgll\":\"nrvgoupmfiibfgg\"},\"id\":\"wjygvjayvblmhvk\",\"name\":\"uhbxvvy\",\"type\":\"gsopbyrqufegxu\"}],\"nextLink\":\"zfbn\"}") + .toObject(TransitHubResourceListResult.class); + Assertions.assertEquals("pjgwwspug", model.value().get(0).location()); + Assertions.assertEquals("qs", model.value().get(0).tags().get("hqxujxukndxdi")); + Assertions.assertEquals(TransitHubState.APPROVED, model.value().get(0).properties().state()); + Assertions.assertEquals(TransitOptionType.GATEWAY, model.value().get(0).properties().transitOption().type()); + Assertions.assertEquals(4051356742453567951L, + model.value().get(0).properties().transitOption().params().scaleUnits()); + Assertions.assertEquals("rqmq", + model.value().get(0).properties().transitOption().params().remoteVirtualNetworkId()); + Assertions.assertEquals("zfbn", model.nextLink()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsCreateOrUpdateMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..6556f199ba0b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsCreateOrUpdateMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubProperties; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubResource; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOption; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class TransitHubsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"state\":\"PendingUpdate\",\"transitOption\":{\"type\":\"ExpressRoute\",\"params\":{\"scaleUnits\":7437458919363278602,\"remoteVirtualNetworkId\":\"lz\"}},\"resourceCollection\":[\"knyuxgvttxpn\",\"upzaamrdixtre\"]},\"location\":\"dswys\",\"tags\":{\"rpq\":\"uffgllukkutvlx\",\"bhbcdszir\":\"vmblcouqe\",\"t\":\"randoypmb\"},\"id\":\"ormkfqlwxldyk\",\"name\":\"lsygaol\",\"type\":\"jpnnbmjksibjgsj\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + TransitHubResource response = manager.transitHubs() + .define("ufr") + .withRegion("rsc") + .withExistingCommunity("hulrtywikdmhla", "uflgbhgauacdixm") + .withTags(mapOf("jxcjrmmuabwib", "wsdrnpxqwodif")) + .withProperties(new TransitHubProperties().withState(TransitHubState.PENDING_UPDATE) + .withTransitOption(new TransitOption().withType(TransitOptionType.PEERING) + .withParams(new TransitOptionParams().withScaleUnits(3604541138001569154L) + .withRemoteVirtualNetworkId("oqbvjhvefgwbmqj")))) + .create(); + + Assertions.assertEquals("dswys", response.location()); + Assertions.assertEquals("uffgllukkutvlx", response.tags().get("rpq")); + Assertions.assertEquals(TransitHubState.PENDING_UPDATE, response.properties().state()); + Assertions.assertEquals(TransitOptionType.EXPRESS_ROUTE, response.properties().transitOption().type()); + Assertions.assertEquals(7437458919363278602L, response.properties().transitOption().params().scaleUnits()); + Assertions.assertEquals("lz", response.properties().transitOption().params().remoteVirtualNetworkId()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsGetWithResponseMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsGetWithResponseMockTests.java new file mode 100644 index 000000000000..b51a944bdaa8 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsGetWithResponseMockTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubResource; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class TransitHubsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Deleting\",\"state\":\"Failed\",\"transitOption\":{\"type\":\"Gateway\",\"params\":{\"scaleUnits\":8616971823570876530,\"remoteVirtualNetworkId\":\"bhpwvqsgnyy\"}},\"resourceCollection\":[\"ivensrpmeyyvpk\",\"atlb\"]},\"location\":\"pzgsk\",\"tags\":{\"xwcdomm\":\"hfvolmknb\"},\"id\":\"vfqawzfgbrttuiac\",\"name\":\"kiexhajlfnthiq\",\"type\":\"yuttdiygbpvnwswm\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + TransitHubResource response = manager.transitHubs() + .getWithResponse("crrpcjttbstvje", "qnrmvvfko", "mlghktuidvrmazlp", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("pzgsk", response.location()); + Assertions.assertEquals("hfvolmknb", response.tags().get("xwcdomm")); + Assertions.assertEquals(TransitHubState.FAILED, response.properties().state()); + Assertions.assertEquals(TransitOptionType.GATEWAY, response.properties().transitOption().type()); + Assertions.assertEquals(8616971823570876530L, response.properties().transitOption().params().scaleUnits()); + Assertions.assertEquals("bhpwvqsgnyy", response.properties().transitOption().params().remoteVirtualNetworkId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsListByCommunityResourceMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsListByCommunityResourceMockTests.java new file mode 100644 index 000000000000..0d9301f1a627 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsListByCommunityResourceMockTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubResource; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class TransitHubsListByCommunityResourceMockTests { + @Test + public void testListByCommunityResource() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Creating\",\"state\":\"Active\",\"transitOption\":{\"type\":\"ExpressRoute\",\"params\":{\"scaleUnits\":8562330729590351027,\"remoteVirtualNetworkId\":\"zaifghtmoqqtlff\"}},\"resourceCollection\":[\"krkjjjavf\",\"nvhnqoewdogiye\"]},\"location\":\"sypvidbztjhqtfb\",\"tags\":{\"p\":\"ynkbwetnju\",\"piaccxnafb\":\"prkzya\"},\"id\":\"qroohtu\",\"name\":\"vmaonurjt\",\"type\":\"mghihp\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.transitHubs().listByCommunityResource("xkyctwwgzwx", "l", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("sypvidbztjhqtfb", response.iterator().next().location()); + Assertions.assertEquals("ynkbwetnju", response.iterator().next().tags().get("p")); + Assertions.assertEquals(TransitHubState.ACTIVE, response.iterator().next().properties().state()); + Assertions.assertEquals(TransitOptionType.EXPRESS_ROUTE, + response.iterator().next().properties().transitOption().type()); + Assertions.assertEquals(8562330729590351027L, + response.iterator().next().properties().transitOption().params().scaleUnits()); + Assertions.assertEquals("zaifghtmoqqtlff", + response.iterator().next().properties().transitOption().params().remoteVirtualNetworkId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsListBySubscriptionMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsListBySubscriptionMockTests.java new file mode 100644 index 000000000000..38fc923e06ae --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitHubsListBySubscriptionMockTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubResource; +import com.azure.resourcemanager.virtualenclaves.models.TransitHubState; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class TransitHubsListBySubscriptionMockTests { + @Test + public void testListBySubscription() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"state\":\"Failed\",\"transitOption\":{\"type\":\"Gateway\",\"params\":{\"scaleUnits\":8870278689200078350,\"remoteVirtualNetworkId\":\"xigc\"}},\"resourceCollection\":[\"xu\",\"pbezqccydrtceu\",\"d\",\"kkyihzt\"]},\"location\":\"qm\",\"tags\":{\"chillcecf\":\"gwldo\",\"llizs\":\"huwaoaguhic\",\"jvhrweft\":\"ac\",\"aepwamcxtcz\":\"wqejpmvsse\"},\"id\":\"upeuknijduyye\",\"name\":\"pydjfboc\",\"type\":\"v\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.transitHubs().listBySubscription("ecmslclbl", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qm", response.iterator().next().location()); + Assertions.assertEquals("gwldo", response.iterator().next().tags().get("chillcecf")); + Assertions.assertEquals(TransitHubState.FAILED, response.iterator().next().properties().state()); + Assertions.assertEquals(TransitOptionType.GATEWAY, + response.iterator().next().properties().transitOption().type()); + Assertions.assertEquals(8870278689200078350L, + response.iterator().next().properties().transitOption().params().scaleUnits()); + Assertions.assertEquals("xigc", + response.iterator().next().properties().transitOption().params().remoteVirtualNetworkId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitOptionParamsTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitOptionParamsTests.java new file mode 100644 index 000000000000..6927d0e3b59b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitOptionParamsTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams; +import org.junit.jupiter.api.Assertions; + +public final class TransitOptionParamsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TransitOptionParams model + = BinaryData.fromString("{\"scaleUnits\":647341680559943074,\"remoteVirtualNetworkId\":\"t\"}") + .toObject(TransitOptionParams.class); + Assertions.assertEquals(647341680559943074L, model.scaleUnits()); + Assertions.assertEquals("t", model.remoteVirtualNetworkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TransitOptionParams model + = new TransitOptionParams().withScaleUnits(647341680559943074L).withRemoteVirtualNetworkId("t"); + model = BinaryData.fromObject(model).toObject(TransitOptionParams.class); + Assertions.assertEquals(647341680559943074L, model.scaleUnits()); + Assertions.assertEquals("t", model.remoteVirtualNetworkId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitOptionTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitOptionTests.java new file mode 100644 index 000000000000..ad308553cbba --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/TransitOptionTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.TransitOption; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionParams; +import com.azure.resourcemanager.virtualenclaves.models.TransitOptionType; +import org.junit.jupiter.api.Assertions; + +public final class TransitOptionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TransitOption model = BinaryData.fromString( + "{\"type\":\"ExpressRoute\",\"params\":{\"scaleUnits\":5146168087971383539,\"remoteVirtualNetworkId\":\"dsrezpdrhneuyow\"}}") + .toObject(TransitOption.class); + Assertions.assertEquals(TransitOptionType.EXPRESS_ROUTE, model.type()); + Assertions.assertEquals(5146168087971383539L, model.params().scaleUnits()); + Assertions.assertEquals("dsrezpdrhneuyow", model.params().remoteVirtualNetworkId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TransitOption model = new TransitOption().withType(TransitOptionType.EXPRESS_ROUTE) + .withParams(new TransitOptionParams().withScaleUnits(5146168087971383539L) + .withRemoteVirtualNetworkId("dsrezpdrhneuyow")); + model = BinaryData.fromObject(model).toObject(TransitOption.class); + Assertions.assertEquals(TransitOptionType.EXPRESS_ROUTE, model.type()); + Assertions.assertEquals(5146168087971383539L, model.params().scaleUnits()); + Assertions.assertEquals("dsrezpdrhneuyow", model.params().remoteVirtualNetworkId()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/UserAssignedIdentityTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/UserAssignedIdentityTests.java new file mode 100644 index 000000000000..b85f4f9ebc76 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/UserAssignedIdentityTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model = BinaryData.fromString("{\"principalId\":\"byao\",\"clientId\":\"e\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavePatchModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavePatchModelTests.java new file mode 100644 index 000000000000..330444772008 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavePatchModelTests.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.DiagnosticDestination; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveDefaultSettingsPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentity; +import com.azure.resourcemanager.virtualenclaves.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import com.azure.resourcemanager.virtualenclaves.models.UserAssignedIdentity; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchModel; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class VirtualEnclavePatchModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualEnclavePatchModel model = BinaryData.fromString( + "{\"properties\":{\"enclaveVirtualNetwork\":{\"networkName\":\"onpc\",\"networkSize\":\"ocohslkevleg\",\"customCidrRange\":\"fbuhfmvfaxkffe\",\"subnetConfigurations\":[{\"subnetName\":\"hl\",\"subnetResourceId\":\"ez\",\"networkPrefixSize\":72720177,\"subnetDelegation\":\"hxmzsbbzoggig\",\"addressPrefix\":\"wburvjxxjnspydpt\",\"networkSecurityGroupResourceId\":\"enkouknvudw\"}],\"allowSubnetCommunication\":true},\"bastionEnabled\":true,\"enclaveRoleAssignments\":[{\"roleDefinitionId\":\"ngkpocipazy\",\"principals\":[{\"id\":\"gukgjnpiucgygevq\",\"type\":\"ServicePrincipal\"},{\"id\":\"typmrbpizcdrqjsd\",\"type\":\"ServicePrincipal\"},{\"id\":\"dnfyhxdeoejzicwi\",\"type\":\"ServicePrincipal\"}]}],\"workloadRoleAssignments\":[{\"roleDefinitionId\":\"tgzfbishcbkh\",\"principals\":[{\"id\":\"eyeam\",\"type\":\"Group\"},{\"id\":\"hagalpbuxwgipwh\",\"type\":\"Group\"},{\"id\":\"ow\",\"type\":\"ServicePrincipal\"},{\"id\":\"shwankixzbinje\",\"type\":\"ServicePrincipal\"}]},{\"roleDefinitionId\":\"ttmrywnuzoqf\",\"principals\":[{\"id\":\"qzrnkcqvyxlwhz\",\"type\":\"Group\"},{\"id\":\"icohoqqnwvl\",\"type\":\"User\"},{\"id\":\"avwhheunm\",\"type\":\"Group\"},{\"id\":\"hgyxzkonoc\",\"type\":\"ServicePrincipal\"}]}],\"governedServiceList\":[{\"serviceId\":\"Monitoring\",\"serviceName\":\"axuconuq\",\"option\":\"Deny\",\"enforcement\":\"Disabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"wrmjmwvvjektc\",\"senhwlrs\",\"frzpwvlqdqgb\",\"qylihkaetckt\"]},{\"serviceId\":\"ContainerRegistry\",\"serviceName\":\"ivfsnk\",\"option\":\"ExceptionOnly\",\"enforcement\":\"Disabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"bebrjcxerfuwuttt\",\"fvjrbirphxepcy\",\"ahfn\"]},{\"serviceId\":\"ContainerRegistry\",\"serviceName\":\"yq\",\"option\":\"Deny\",\"enforcement\":\"Enabled\",\"policyAction\":\"None\",\"initiatives\":[\"dokgjl\",\"yoxgvcltbgsnc\"]}],\"enclaveDefaultSettings\":{\"diagnosticDestination\":\"CommunityOnly\"},\"maintenanceModeConfiguration\":{\"mode\":\"CanNotDelete\",\"principals\":[{\"id\":\"hbijhtxfvgxb\",\"type\":\"ServicePrincipal\"},{\"id\":\"mxnehmp\",\"type\":\"User\"},{\"id\":\"cxgod\",\"type\":\"User\"}],\"justification\":\"Off\"}},\"identity\":{\"principalId\":\"rbmpukgri\",\"tenantId\":\"lzlfbxzpuz\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"drgvtqagn\":{\"principalId\":\"nqzahmgkbrpyyd\",\"clientId\":\"bnuqqkpik\"},\"zzmhjrunmpxttd\":{\"principalId\":\"ynhijggme\",\"clientId\":\"siarbutrcvpn\"},\"nrs\":{\"principalId\":\"rbnlankxmyskp\",\"clientId\":\"enbtkcxywny\"}}},\"tags\":{\"zfcl\":\"qidybyx\",\"fkts\":\"aaxdbabphlwrq\"}}") + .toObject(VirtualEnclavePatchModel.class); + Assertions.assertEquals("onpc", model.properties().enclaveVirtualNetwork().networkName()); + Assertions.assertEquals("ocohslkevleg", model.properties().enclaveVirtualNetwork().networkSize()); + Assertions.assertEquals("fbuhfmvfaxkffe", model.properties().enclaveVirtualNetwork().customCidrRange()); + Assertions.assertEquals("hl", + model.properties().enclaveVirtualNetwork().subnetConfigurations().get(0).subnetName()); + Assertions.assertEquals(72720177, + model.properties().enclaveVirtualNetwork().subnetConfigurations().get(0).networkPrefixSize()); + Assertions.assertEquals("hxmzsbbzoggig", + model.properties().enclaveVirtualNetwork().subnetConfigurations().get(0).subnetDelegation()); + Assertions.assertTrue(model.properties().enclaveVirtualNetwork().allowSubnetCommunication()); + Assertions.assertTrue(model.properties().bastionEnabled()); + Assertions.assertEquals("ngkpocipazy", model.properties().enclaveRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("gukgjnpiucgygevq", + model.properties().enclaveRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.properties().enclaveRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals("tgzfbishcbkh", model.properties().workloadRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("eyeam", model.properties().workloadRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.GROUP, + model.properties().workloadRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(ServiceIdentifier.MONITORING, + model.properties().governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.DENY, + model.properties().governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.DISABLED, + model.properties().governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.AUDIT_ONLY, + model.properties().governedServiceList().get(0).policyAction()); + Assertions.assertEquals(DiagnosticDestination.COMMUNITY_ONLY, + model.properties().enclaveDefaultSettings().diagnosticDestination()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.CAN_NOT_DELETE, + model.properties().maintenanceModeConfiguration().mode()); + Assertions.assertEquals("hbijhtxfvgxb", + model.properties().maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.properties().maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.OFF, + model.properties().maintenanceModeConfiguration().justification()); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.identity().type()); + Assertions.assertEquals("qidybyx", model.tags().get("zfcl")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualEnclavePatchModel model = new VirtualEnclavePatchModel() + .withProperties(new VirtualEnclavePatchProperties() + .withEnclaveVirtualNetwork(new EnclaveVirtualNetworkModel().withNetworkName("onpc") + .withNetworkSize("ocohslkevleg") + .withCustomCidrRange("fbuhfmvfaxkffe") + .withSubnetConfigurations(Arrays.asList(new SubnetConfiguration().withSubnetName("hl") + .withNetworkPrefixSize(72720177) + .withSubnetDelegation("hxmzsbbzoggig"))) + .withAllowSubnetCommunication(true)) + .withBastionEnabled(true) + .withEnclaveRoleAssignments(Arrays.asList(new RoleAssignmentItem().withRoleDefinitionId("ngkpocipazy") + .withPrincipals(Arrays.asList( + new Principal().withId("gukgjnpiucgygevq").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("typmrbpizcdrqjsd").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("dnfyhxdeoejzicwi").withType(PrincipalType.SERVICE_PRINCIPAL))))) + .withWorkloadRoleAssignments( + Arrays + .asList( + new RoleAssignmentItem().withRoleDefinitionId("tgzfbishcbkh") + .withPrincipals( + Arrays.asList(new Principal().withId("eyeam").withType(PrincipalType.GROUP), + new Principal().withId("hagalpbuxwgipwh").withType(PrincipalType.GROUP), + new Principal().withId("ow").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("shwankixzbinje") + .withType(PrincipalType.SERVICE_PRINCIPAL))), + new RoleAssignmentItem().withRoleDefinitionId("ttmrywnuzoqf") + .withPrincipals(Arrays.asList( + new Principal().withId("qzrnkcqvyxlwhz").withType(PrincipalType.GROUP), + new Principal().withId("icohoqqnwvl").withType(PrincipalType.USER), + new Principal().withId("avwhheunm").withType(PrincipalType.GROUP), + new Principal().withId("hgyxzkonoc").withType(PrincipalType.SERVICE_PRINCIPAL))))) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withServiceId(ServiceIdentifier.MONITORING) + .withOption(GovernedServiceItemOption.DENY) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY), + new GovernedServiceItem().withServiceId(ServiceIdentifier.CONTAINER_REGISTRY) + .withOption(GovernedServiceItemOption.EXCEPTION_ONLY) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY), + new GovernedServiceItem().withServiceId(ServiceIdentifier.CONTAINER_REGISTRY) + .withOption(GovernedServiceItemOption.DENY) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE))) + .withEnclaveDefaultSettings(new EnclaveDefaultSettingsPatchModel() + .withDiagnosticDestination(DiagnosticDestination.COMMUNITY_ONLY)) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationPatchModel() + .withMode(MaintenanceModeConfigurationModelMode.CAN_NOT_DELETE) + .withPrincipals( + Arrays.asList(new Principal().withId("hbijhtxfvgxb").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("mxnehmp").withType(PrincipalType.USER), + new Principal().withId("cxgod").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationModelJustification.OFF))) + .withIdentity( + new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("drgvtqagn", new UserAssignedIdentity(), "zzmhjrunmpxttd", + new UserAssignedIdentity(), "nrs", new UserAssignedIdentity()))) + .withTags(mapOf("zfcl", "qidybyx", "fkts", "aaxdbabphlwrq")); + model = BinaryData.fromObject(model).toObject(VirtualEnclavePatchModel.class); + Assertions.assertEquals("onpc", model.properties().enclaveVirtualNetwork().networkName()); + Assertions.assertEquals("ocohslkevleg", model.properties().enclaveVirtualNetwork().networkSize()); + Assertions.assertEquals("fbuhfmvfaxkffe", model.properties().enclaveVirtualNetwork().customCidrRange()); + Assertions.assertEquals("hl", + model.properties().enclaveVirtualNetwork().subnetConfigurations().get(0).subnetName()); + Assertions.assertEquals(72720177, + model.properties().enclaveVirtualNetwork().subnetConfigurations().get(0).networkPrefixSize()); + Assertions.assertEquals("hxmzsbbzoggig", + model.properties().enclaveVirtualNetwork().subnetConfigurations().get(0).subnetDelegation()); + Assertions.assertTrue(model.properties().enclaveVirtualNetwork().allowSubnetCommunication()); + Assertions.assertTrue(model.properties().bastionEnabled()); + Assertions.assertEquals("ngkpocipazy", model.properties().enclaveRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("gukgjnpiucgygevq", + model.properties().enclaveRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.properties().enclaveRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals("tgzfbishcbkh", model.properties().workloadRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("eyeam", model.properties().workloadRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.GROUP, + model.properties().workloadRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(ServiceIdentifier.MONITORING, + model.properties().governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.DENY, + model.properties().governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.DISABLED, + model.properties().governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.AUDIT_ONLY, + model.properties().governedServiceList().get(0).policyAction()); + Assertions.assertEquals(DiagnosticDestination.COMMUNITY_ONLY, + model.properties().enclaveDefaultSettings().diagnosticDestination()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.CAN_NOT_DELETE, + model.properties().maintenanceModeConfiguration().mode()); + Assertions.assertEquals("hbijhtxfvgxb", + model.properties().maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.properties().maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.OFF, + model.properties().maintenanceModeConfiguration().justification()); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.identity().type()); + Assertions.assertEquals("qidybyx", model.tags().get("zfcl")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavePatchPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavePatchPropertiesTests.java new file mode 100644 index 000000000000..9bdf8a31c7d5 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavePatchPropertiesTests.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.DiagnosticDestination; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveDefaultSettingsPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.EnclaveVirtualNetworkModel; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItem; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemOption; +import com.azure.resourcemanager.virtualenclaves.models.GovernedServiceItemPolicyAction; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelJustification; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationModelMode; +import com.azure.resourcemanager.virtualenclaves.models.MaintenanceModeConfigurationPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.Principal; +import com.azure.resourcemanager.virtualenclaves.models.PrincipalType; +import com.azure.resourcemanager.virtualenclaves.models.RoleAssignmentItem; +import com.azure.resourcemanager.virtualenclaves.models.ServiceIdentifier; +import com.azure.resourcemanager.virtualenclaves.models.SubnetConfiguration; +import com.azure.resourcemanager.virtualenclaves.models.VirtualEnclavePatchProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VirtualEnclavePatchPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualEnclavePatchProperties model = BinaryData.fromString( + "{\"enclaveVirtualNetwork\":{\"networkName\":\"sucocmnyyazttbtw\",\"networkSize\":\"qpuedckzywbiex\",\"customCidrRange\":\"eyueaxibxujwb\",\"subnetConfigurations\":[{\"subnetName\":\"almuzyoxaepdkzja\",\"subnetResourceId\":\"ux\",\"networkPrefixSize\":1487648770,\"subnetDelegation\":\"wbavxbniwdj\",\"addressPrefix\":\"zt\",\"networkSecurityGroupResourceId\":\"bpg\"}],\"allowSubnetCommunication\":false},\"bastionEnabled\":false,\"enclaveRoleAssignments\":[{\"roleDefinitionId\":\"zxbzpfzabglc\",\"principals\":[{\"id\":\"wtctyqi\",\"type\":\"User\"},{\"id\":\"bbovplwzbhvgyugu\",\"type\":\"User\"},{\"id\":\"vmkfssxqu\",\"type\":\"Group\"},{\"id\":\"fpl\",\"type\":\"ServicePrincipal\"}]},{\"roleDefinitionId\":\"gsxnkjzkdeslpv\",\"principals\":[{\"id\":\"wiyighxpkdw\",\"type\":\"ServicePrincipal\"},{\"id\":\"aiuebbaumnyqu\",\"type\":\"Group\"}]}],\"workloadRoleAssignments\":[{\"roleDefinitionId\":\"ojnabckhsmtxpsie\",\"principals\":[{\"id\":\"hvpesapskrdqm\",\"type\":\"ServicePrincipal\"},{\"id\":\"jdhtldwkyzxu\",\"type\":\"ServicePrincipal\"},{\"id\":\"kn\",\"type\":\"User\"}]},{\"roleDefinitionId\":\"scwsv\",\"principals\":[{\"id\":\"togt\",\"type\":\"ServicePrincipal\"},{\"id\":\"upqsx\",\"type\":\"User\"},{\"id\":\"micykvceoveilo\",\"type\":\"Group\"}]}],\"governedServiceList\":[{\"serviceId\":\"AKS\",\"serviceName\":\"jfcn\",\"option\":\"Allow\",\"enforcement\":\"Enabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"ttkphywpnvjtoqne\"]},{\"serviceId\":\"PrivateDNSZones\",\"serviceName\":\"lfplp\",\"option\":\"Allow\",\"enforcement\":\"Disabled\",\"policyAction\":\"None\",\"initiatives\":[\"bgyepsbj\"]},{\"serviceId\":\"PrivateDNSZones\",\"serviceName\":\"qugxywpmueefjzwf\",\"option\":\"Allow\",\"enforcement\":\"Disabled\",\"policyAction\":\"Enforce\",\"initiatives\":[\"yonobgl\",\"ocqxtccmg\",\"udxytlmoyrx\"]},{\"serviceId\":\"Insights\",\"serviceName\":\"u\",\"option\":\"Allow\",\"enforcement\":\"Disabled\",\"policyAction\":\"AuditOnly\",\"initiatives\":[\"zhlrqjb\",\"ck\"]}],\"enclaveDefaultSettings\":{\"diagnosticDestination\":\"CommunityOnly\"},\"maintenanceModeConfiguration\":{\"mode\":\"CanNotDelete\",\"principals\":[{\"id\":\"kyv\",\"type\":\"User\"},{\"id\":\"ca\",\"type\":\"Group\"}],\"justification\":\"Networking\"}}") + .toObject(VirtualEnclavePatchProperties.class); + Assertions.assertEquals("sucocmnyyazttbtw", model.enclaveVirtualNetwork().networkName()); + Assertions.assertEquals("qpuedckzywbiex", model.enclaveVirtualNetwork().networkSize()); + Assertions.assertEquals("eyueaxibxujwb", model.enclaveVirtualNetwork().customCidrRange()); + Assertions.assertEquals("almuzyoxaepdkzja", + model.enclaveVirtualNetwork().subnetConfigurations().get(0).subnetName()); + Assertions.assertEquals(1487648770, + model.enclaveVirtualNetwork().subnetConfigurations().get(0).networkPrefixSize()); + Assertions.assertEquals("wbavxbniwdj", + model.enclaveVirtualNetwork().subnetConfigurations().get(0).subnetDelegation()); + Assertions.assertFalse(model.enclaveVirtualNetwork().allowSubnetCommunication()); + Assertions.assertFalse(model.bastionEnabled()); + Assertions.assertEquals("zxbzpfzabglc", model.enclaveRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("wtctyqi", model.enclaveRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.enclaveRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals("ojnabckhsmtxpsie", model.workloadRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("hvpesapskrdqm", model.workloadRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.workloadRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(ServiceIdentifier.AKS, model.governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.ALLOW, model.governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.ENABLED, + model.governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.AUDIT_ONLY, + model.governedServiceList().get(0).policyAction()); + Assertions.assertEquals(DiagnosticDestination.COMMUNITY_ONLY, + model.enclaveDefaultSettings().diagnosticDestination()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.CAN_NOT_DELETE, + model.maintenanceModeConfiguration().mode()); + Assertions.assertEquals("kyv", model.maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.NETWORKING, + model.maintenanceModeConfiguration().justification()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualEnclavePatchProperties model = new VirtualEnclavePatchProperties() + .withEnclaveVirtualNetwork(new EnclaveVirtualNetworkModel().withNetworkName("sucocmnyyazttbtw") + .withNetworkSize("qpuedckzywbiex") + .withCustomCidrRange("eyueaxibxujwb") + .withSubnetConfigurations(Arrays.asList(new SubnetConfiguration().withSubnetName("almuzyoxaepdkzja") + .withNetworkPrefixSize(1487648770) + .withSubnetDelegation("wbavxbniwdj"))) + .withAllowSubnetCommunication(false)) + .withBastionEnabled(false) + .withEnclaveRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("zxbzpfzabglc") + .withPrincipals(Arrays.asList(new Principal().withId("wtctyqi").withType(PrincipalType.USER), + new Principal().withId("bbovplwzbhvgyugu").withType(PrincipalType.USER), + new Principal().withId("vmkfssxqu").withType(PrincipalType.GROUP), + new Principal().withId("fpl").withType(PrincipalType.SERVICE_PRINCIPAL))), + new RoleAssignmentItem().withRoleDefinitionId("gsxnkjzkdeslpv") + .withPrincipals( + Arrays.asList(new Principal().withId("wiyighxpkdw").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("aiuebbaumnyqu").withType(PrincipalType.GROUP))))) + .withWorkloadRoleAssignments( + Arrays.asList( + new RoleAssignmentItem().withRoleDefinitionId("ojnabckhsmtxpsie") + .withPrincipals(Arrays.asList( + new Principal().withId("hvpesapskrdqm").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("jdhtldwkyzxu").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("kn").withType(PrincipalType.USER))), + new RoleAssignmentItem().withRoleDefinitionId("scwsv") + .withPrincipals( + Arrays.asList(new Principal().withId("togt").withType(PrincipalType.SERVICE_PRINCIPAL), + new Principal().withId("upqsx").withType(PrincipalType.USER), + new Principal().withId("micykvceoveilo").withType(PrincipalType.GROUP))))) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withServiceId(ServiceIdentifier.AKS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY), + new GovernedServiceItem().withServiceId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.NONE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.ENFORCE), + new GovernedServiceItem().withServiceId(ServiceIdentifier.INSIGHTS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.DISABLED) + .withPolicyAction(GovernedServiceItemPolicyAction.AUDIT_ONLY))) + .withEnclaveDefaultSettings( + new EnclaveDefaultSettingsPatchModel().withDiagnosticDestination(DiagnosticDestination.COMMUNITY_ONLY)) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationPatchModel() + .withMode(MaintenanceModeConfigurationModelMode.CAN_NOT_DELETE) + .withPrincipals(Arrays.asList(new Principal().withId("kyv").withType(PrincipalType.USER), + new Principal().withId("ca").withType(PrincipalType.GROUP))) + .withJustification(MaintenanceModeConfigurationModelJustification.NETWORKING)); + model = BinaryData.fromObject(model).toObject(VirtualEnclavePatchProperties.class); + Assertions.assertEquals("sucocmnyyazttbtw", model.enclaveVirtualNetwork().networkName()); + Assertions.assertEquals("qpuedckzywbiex", model.enclaveVirtualNetwork().networkSize()); + Assertions.assertEquals("eyueaxibxujwb", model.enclaveVirtualNetwork().customCidrRange()); + Assertions.assertEquals("almuzyoxaepdkzja", + model.enclaveVirtualNetwork().subnetConfigurations().get(0).subnetName()); + Assertions.assertEquals(1487648770, + model.enclaveVirtualNetwork().subnetConfigurations().get(0).networkPrefixSize()); + Assertions.assertEquals("wbavxbniwdj", + model.enclaveVirtualNetwork().subnetConfigurations().get(0).subnetDelegation()); + Assertions.assertFalse(model.enclaveVirtualNetwork().allowSubnetCommunication()); + Assertions.assertFalse(model.bastionEnabled()); + Assertions.assertEquals("zxbzpfzabglc", model.enclaveRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("wtctyqi", model.enclaveRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.enclaveRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals("ojnabckhsmtxpsie", model.workloadRoleAssignments().get(0).roleDefinitionId()); + Assertions.assertEquals("hvpesapskrdqm", model.workloadRoleAssignments().get(0).principals().get(0).id()); + Assertions.assertEquals(PrincipalType.SERVICE_PRINCIPAL, + model.workloadRoleAssignments().get(0).principals().get(0).type()); + Assertions.assertEquals(ServiceIdentifier.AKS, model.governedServiceList().get(0).serviceId()); + Assertions.assertEquals(GovernedServiceItemOption.ALLOW, model.governedServiceList().get(0).option()); + Assertions.assertEquals(GovernedServiceItemEnforcement.ENABLED, + model.governedServiceList().get(0).enforcement()); + Assertions.assertEquals(GovernedServiceItemPolicyAction.AUDIT_ONLY, + model.governedServiceList().get(0).policyAction()); + Assertions.assertEquals(DiagnosticDestination.COMMUNITY_ONLY, + model.enclaveDefaultSettings().diagnosticDestination()); + Assertions.assertEquals(MaintenanceModeConfigurationModelMode.CAN_NOT_DELETE, + model.maintenanceModeConfiguration().mode()); + Assertions.assertEquals("kyv", model.maintenanceModeConfiguration().principals().get(0).id()); + Assertions.assertEquals(PrincipalType.USER, model.maintenanceModeConfiguration().principals().get(0).type()); + Assertions.assertEquals(MaintenanceModeConfigurationModelJustification.NETWORKING, + model.maintenanceModeConfiguration().justification()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavesHandleApprovalCreationMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavesHandleApprovalCreationMockTests.java new file mode 100644 index 000000000000..22683b1f03a0 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavesHandleApprovalCreationMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalCallbackRequestResourceRequestAction; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class VirtualEnclavesHandleApprovalCreationMockTests { + @Test + public void testHandleApprovalCreation() throws Exception { + String responseStr = "{\"message\":\"owjrmzvuporqz\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ApprovalActionResponse response = manager.virtualEnclaves() + .handleApprovalCreation("knidib", "qjxgpnrhgovfgp", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.UPDATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED) + .withApprovalCallbackPayload("hh"), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("owjrmzvuporqz", response.message()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavesHandleApprovalDeletionMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavesHandleApprovalDeletionMockTests.java new file mode 100644 index 000000000000..b360de5833e0 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/VirtualEnclavesHandleApprovalDeletionMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalActionResponse; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.virtualenclaves.models.ApprovalDeletionCallbackRequestResourceRequestAction; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class VirtualEnclavesHandleApprovalDeletionMockTests { + @Test + public void testHandleApprovalDeletion() throws Exception { + String responseStr = "{\"message\":\"khlg\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ApprovalActionResponse response = manager.virtualEnclaves() + .handleApprovalDeletion("fuyd", "vkfvxcnqmxqpswok", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.DELETE), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("khlg", response.message()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadPatchModelTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadPatchModelTests.java new file mode 100644 index 000000000000..63a8fc2d78f2 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadPatchModelTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchModel; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class WorkloadPatchModelTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkloadPatchModel model = BinaryData.fromString( + "{\"properties\":{\"resourceGroupCollection\":[\"hbcryffdfdosyge\"]},\"tags\":{\"dphlxaolt\":\"ojakhmsbzjhcrze\",\"f\":\"qtrgqjbpfzfsinzg\",\"j\":\"jrwzox\",\"fpjkjlxofp\":\"felluwfzitonpe\"}}") + .toObject(WorkloadPatchModel.class); + Assertions.assertEquals("hbcryffdfdosyge", model.properties().resourceGroupCollection().get(0)); + Assertions.assertEquals("ojakhmsbzjhcrze", model.tags().get("dphlxaolt")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkloadPatchModel model = new WorkloadPatchModel() + .withProperties(new WorkloadPatchProperties().withResourceGroupCollection(Arrays.asList("hbcryffdfdosyge"))) + .withTags(mapOf("dphlxaolt", "ojakhmsbzjhcrze", "f", "qtrgqjbpfzfsinzg", "j", "jrwzox", "fpjkjlxofp", + "felluwfzitonpe")); + model = BinaryData.fromObject(model).toObject(WorkloadPatchModel.class); + Assertions.assertEquals("hbcryffdfdosyge", model.properties().resourceGroupCollection().get(0)); + Assertions.assertEquals("ojakhmsbzjhcrze", model.tags().get("dphlxaolt")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadPatchPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadPatchPropertiesTests.java new file mode 100644 index 000000000000..f467987a808c --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadPatchPropertiesTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadPatchProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class WorkloadPatchPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkloadPatchProperties model = BinaryData.fromString("{\"resourceGroupCollection\":[\"pfxxy\"]}") + .toObject(WorkloadPatchProperties.class); + Assertions.assertEquals("pfxxy", model.resourceGroupCollection().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkloadPatchProperties model + = new WorkloadPatchProperties().withResourceGroupCollection(Arrays.asList("pfxxy")); + model = BinaryData.fromObject(model).toObject(WorkloadPatchProperties.class); + Assertions.assertEquals("pfxxy", model.resourceGroupCollection().get(0)); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadPropertiesTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadPropertiesTests.java new file mode 100644 index 000000000000..7bfd038c9f2f --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadProperties; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class WorkloadPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkloadProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Failed\",\"resourceGroupCollection\":[\"npmqnjaqwixjspro\"],\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"tegjvwmf\"},{\"id\":\"t\"},{\"id\":\"mdvpjhulsu\"}]}}") + .toObject(WorkloadProperties.class); + Assertions.assertEquals("npmqnjaqwixjspro", model.resourceGroupCollection().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkloadProperties model + = new WorkloadProperties().withResourceGroupCollection(Arrays.asList("npmqnjaqwixjspro")); + model = BinaryData.fromObject(model).toObject(WorkloadProperties.class); + Assertions.assertEquals("npmqnjaqwixjspro", model.resourceGroupCollection().get(0)); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadResourceInnerTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadResourceInnerTests.java new file mode 100644 index 000000000000..e9b6af57d1a7 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadResourceInnerTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.fluent.models.WorkloadResourceInner; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class WorkloadResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkloadResourceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Deleting\",\"resourceGroupCollection\":[\"zvgnwzs\",\"mglzufcy\",\"kohdbiha\",\"ufhfcbjysa\"],\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"qhabifpikxwcz\"}]}},\"location\":\"scnpqxuhivy\",\"tags\":{\"rkxvdum\":\"wby\",\"xgaudccs\":\"grtfwvu\",\"jcny\":\"h\",\"kryhtnapczwlokj\":\"j\"},\"id\":\"emkkvnipjox\",\"name\":\"jnchgej\",\"type\":\"podmailzydehojwy\"}") + .toObject(WorkloadResourceInner.class); + Assertions.assertEquals("scnpqxuhivy", model.location()); + Assertions.assertEquals("wby", model.tags().get("rkxvdum")); + Assertions.assertEquals("zvgnwzs", model.properties().resourceGroupCollection().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkloadResourceInner model = new WorkloadResourceInner().withLocation("scnpqxuhivy") + .withTags(mapOf("rkxvdum", "wby", "xgaudccs", "grtfwvu", "jcny", "h", "kryhtnapczwlokj", "j")) + .withProperties(new WorkloadProperties() + .withResourceGroupCollection(Arrays.asList("zvgnwzs", "mglzufcy", "kohdbiha", "ufhfcbjysa"))); + model = BinaryData.fromObject(model).toObject(WorkloadResourceInner.class); + Assertions.assertEquals("scnpqxuhivy", model.location()); + Assertions.assertEquals("wby", model.tags().get("rkxvdum")); + Assertions.assertEquals("zvgnwzs", model.properties().resourceGroupCollection().get(0)); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadResourceListResultTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadResourceListResultTests.java new file mode 100644 index 000000000000..cdcd32b51db1 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadResourceListResultTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.virtualenclaves.implementation.models.WorkloadResourceListResult; +import org.junit.jupiter.api.Assertions; + +public final class WorkloadResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkloadResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Deleting\",\"resourceGroupCollection\":[\"yhuybbkpod\",\"po\"],\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{},{},{}]}},\"location\":\"vamih\",\"tags\":{\"vyevcciqi\":\"narxzxtheotus\",\"zrnf\":\"nhungbw\",\"spemvtzfk\":\"gxg\"},\"id\":\"fublj\",\"name\":\"fxqeof\",\"type\":\"aeqjhqjbasvms\"},{\"properties\":{\"provisioningState\":\"NotSpecified\",\"resourceGroupCollection\":[\"gsntnbybkzgcwr\",\"clxxwrljdo\",\"skcqvkocrcjd\"],\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{}]}},\"location\":\"xbnjbiksq\",\"tags\":{\"fmppe\":\"ssainqpjwnzll\",\"c\":\"bvmgxsabkyqduuji\"},\"id\":\"czdzev\",\"name\":\"dhkrwpdappdsbdk\",\"type\":\"wrwjfeu\"}],\"nextLink\":\"hutje\"}") + .toObject(WorkloadResourceListResult.class); + Assertions.assertEquals("vamih", model.value().get(0).location()); + Assertions.assertEquals("narxzxtheotus", model.value().get(0).tags().get("vyevcciqi")); + Assertions.assertEquals("yhuybbkpod", model.value().get(0).properties().resourceGroupCollection().get(0)); + Assertions.assertEquals("hutje", model.nextLink()); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsCreateOrUpdateMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..24c9eaae57ab --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsCreateOrUpdateMockTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadProperties; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class WorkloadsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"resourceGroupCollection\":[\"uxtyasiibmi\",\"bnn\",\"stgnl\",\"hnmgixhcm\"],\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"oudorhcgyyp\"},{\"id\":\"twypundmbxh\"},{\"id\":\"cmjkavlgorbmftpm\"}]}},\"location\":\"zfjltfvnzcyjto\",\"tags\":{\"bdb\":\"opv\",\"ibcysihsgqc\":\"qgqqihedsvqwthmk\"},\"id\":\"dhohsdtmcdzsuf\",\"name\":\"ohdxbzlmcmu\",\"type\":\"pcvhdbevwqqxeys\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + WorkloadResource response = manager.workloads() + .define("fnmdxotn") + .withRegion("leohibetnluankr") + .withExistingVirtualEnclave("lzo", "hpc") + .withTags(mapOf("mq", "eeebtijvacv", "nw", "bqqxlaj", "afgaoqlt", "acevehjkuyx", "gv", "aeylinm")) + .withProperties(new WorkloadProperties() + .withResourceGroupCollection(Arrays.asList("eyzihgrky", "i", "absnmfpp", "ojeevy"))) + .create(); + + Assertions.assertEquals("zfjltfvnzcyjto", response.location()); + Assertions.assertEquals("opv", response.tags().get("bdb")); + Assertions.assertEquals("uxtyasiibmi", response.properties().resourceGroupCollection().get(0)); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsGetWithResponseMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsGetWithResponseMockTests.java new file mode 100644 index 000000000000..63f3b6b2e769 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsGetWithResponseMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class WorkloadsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Failed\",\"resourceGroupCollection\":[\"ujrtrhqvwr\"],\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"nlnzonzlrpi\"}]}},\"location\":\"wncvjtszcofiz\",\"tags\":{\"jeamurv\":\"dhgbjkvre\",\"mjerbdk\":\"mlovuanashcxl\",\"bccxjmonfdgn\":\"lvidizozs\"},\"id\":\"n\",\"name\":\"ypuuwwltvuqjctze\",\"type\":\"keifzzhmkdasv\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + WorkloadResource response = manager.workloads() + .getWithResponse("frddgamquhiosrsj", "ivfcdisyirnx", "hcz", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("wncvjtszcofiz", response.location()); + Assertions.assertEquals("dhgbjkvre", response.tags().get("jeamurv")); + Assertions.assertEquals("ujrtrhqvwr", response.properties().resourceGroupCollection().get(0)); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsListByEnclaveResourceMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsListByEnclaveResourceMockTests.java new file mode 100644 index 000000000000..f42e6c6839f8 --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsListByEnclaveResourceMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class WorkloadsListByEnclaveResourceMockTests { + @Test + public void testListByEnclaveResource() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"resourceGroupCollection\":[\"rb\",\"ldforobwj\",\"vizbfhfo\"],\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"pbt\"},{\"id\":\"dxe\"}]}},\"location\":\"abbelawumuaslzk\",\"tags\":{\"nomdrkywuhpsv\":\"woycqucwyha\",\"xzsrzpge\":\"uurutlwexxwlalni\",\"yb\":\"q\"},\"id\":\"wwpgdakchzyvlixq\",\"name\":\"rkcxkj\",\"type\":\"bn\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.workloads().listByEnclaveResource("lyhb", "cu", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("abbelawumuaslzk", response.iterator().next().location()); + Assertions.assertEquals("woycqucwyha", response.iterator().next().tags().get("nomdrkywuhpsv")); + Assertions.assertEquals("rb", response.iterator().next().properties().resourceGroupCollection().get(0)); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsListBySubscriptionMockTests.java b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsListBySubscriptionMockTests.java new file mode 100644 index 000000000000..d1b6906f4c7b --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/src/test/java/com/azure/resourcemanager/virtualenclaves/generated/WorkloadsListBySubscriptionMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.virtualenclaves.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.virtualenclaves.VirtualEnclavesManager; +import com.azure.resourcemanager.virtualenclaves.models.WorkloadResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class WorkloadsListBySubscriptionMockTests { + @Test + public void testListBySubscription() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Accepted\",\"resourceGroupCollection\":[\"tvlwijpsttexoq\",\"pwcyyufmhr\",\"nc\",\"wmqs\"],\"managedOnBehalfOfConfiguration\":{\"moboBrokerResources\":[{\"id\":\"zhlctddunqndyfpc\"}]}},\"location\":\"qbnj\",\"tags\":{\"qqoli\":\"gegydcwboxjum\",\"aiouaubrjt\":\"r\",\"fuojrngif\":\"oq\"},\"id\":\"rzpasccbiuimzdly\",\"name\":\"dfqwmkyoq\",\"type\":\"fdvruz\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + VirtualEnclavesManager manager = VirtualEnclavesManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.workloads().listBySubscription("mysu", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qbnj", response.iterator().next().location()); + Assertions.assertEquals("gegydcwboxjum", response.iterator().next().tags().get("qqoli")); + Assertions.assertEquals("tvlwijpsttexoq", + response.iterator().next().properties().resourceGroupCollection().get(0)); + } +} diff --git a/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/tsp-location.yaml b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/tsp-location.yaml new file mode 100644 index 000000000000..d703434037cd --- /dev/null +++ b/sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/mission/Mission.Management +commit: 1bd335533d57d11a33d41be9b5841e6986ec3567 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/virtualenclaves/ci.yml b/sdk/virtualenclaves/ci.yml new file mode 100644 index 000000000000..474da4694cd8 --- /dev/null +++ b/sdk/virtualenclaves/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/virtualenclaves/ci.yml + - sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/ + exclude: + - sdk/virtualenclaves/pom.xml + - sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/virtualenclaves/ci.yml + - sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/ + exclude: + - sdk/virtualenclaves/pom.xml + - sdk/virtualenclaves/azure-resourcemanager-virtualenclaves/pom.xml + +parameters: + - name: release_azureresourcemanagervirtualenclaves + displayName: azure-resourcemanager-virtualenclaves + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: virtualenclaves + Artifacts: + - name: azure-resourcemanager-virtualenclaves + groupId: com.azure.resourcemanager + safeName: azureresourcemanagervirtualenclaves + releaseInBatch: ${{ parameters.release_azureresourcemanagervirtualenclaves }} diff --git a/sdk/virtualenclaves/pom.xml b/sdk/virtualenclaves/pom.xml new file mode 100644 index 000000000000..e33265a60c6d --- /dev/null +++ b/sdk/virtualenclaves/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-virtualenclaves-service + pom + 1.0.0 + + + azure-resourcemanager-virtualenclaves + +