diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 92dbd2e57617..aaa6b40303f0 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -473,6 +473,7 @@ com.azure.resourcemanager:azure-resourcemanager-databasewatcher;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-durabletask;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-arizeaiobservabilityeval;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-weightsandbiases;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-mission;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.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index ff71d092c5bb..7130e3694246 100644 --- a/pom.xml +++ b/pom.xml @@ -146,6 +146,7 @@ sdk/metricsadvisor sdk/migration sdk/migrationdiscoverysap + sdk/mission sdk/mixedreality sdk/mobilenetwork sdk/modelsrepository diff --git a/sdk/mission/azure-resourcemanager-mission/CHANGELOG.md b/sdk/mission/azure-resourcemanager-mission/CHANGELOG.md new file mode 100644 index 000000000000..14c38beffda5 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-14) + +- Azure Resource Manager Mission client library for Java. This package contains Microsoft Azure SDK for Mission Management SDK. Microsoft Mission Resource Provider management API. Package tag package-2024-12-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-mission Java SDK. diff --git a/sdk/mission/azure-resourcemanager-mission/README.md b/sdk/mission/azure-resourcemanager-mission/README.md new file mode 100644 index 000000000000..19d9c552b93e --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Mission client library for Java + +Azure Resource Manager Mission client library for Java. + +This package contains Microsoft Azure SDK for Mission Management SDK. Microsoft Mission Resource Provider management API. Package tag package-2024-12-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-mission;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-mission + 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(); +MissionManager manager = MissionManager + .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/mission/azure-resourcemanager-mission/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/mission/azure-resourcemanager-mission/SAMPLE.md b/sdk/mission/azure-resourcemanager-mission/SAMPLE.md new file mode 100644 index 000000000000..c6e7401f7752 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/SAMPLE.md @@ -0,0 +1,2208 @@ +# Code snippets and samples + + +## Approval + +- [CreateOrUpdate](#approval_createorupdate) +- [Delete](#approval_delete) +- [Get](#approval_get) +- [InitiatorCallback](#approval_initiatorcallback) +- [ListByParent](#approval_listbyparent) +- [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 + +- [ApprovalCallback](#communityendpoints_approvalcallback) +- [ApprovalDeletionCallback](#communityendpoints_approvaldeletioncallback) +- [CreateOrUpdate](#communityendpoints_createorupdate) +- [Delete](#communityendpoints_delete) +- [Get](#communityendpoints_get) +- [ListByCommunityResource](#communityendpoints_listbycommunityresource) +- [ListBySubscription](#communityendpoints_listbysubscription) +- [Update](#communityendpoints_update) + +## EnclaveConnection + +- [ApprovalCallback](#enclaveconnection_approvalcallback) +- [ApprovalDeletionCallback](#enclaveconnection_approvaldeletioncallback) +- [CreateOrUpdate](#enclaveconnection_createorupdate) +- [Delete](#enclaveconnection_delete) +- [GetByResourceGroup](#enclaveconnection_getbyresourcegroup) +- [List](#enclaveconnection_list) +- [ListByResourceGroup](#enclaveconnection_listbyresourcegroup) +- [Update](#enclaveconnection_update) + +## EnclaveEndpoints + +- [ApprovalCallback](#enclaveendpoints_approvalcallback) +- [ApprovalDeletionCallback](#enclaveendpoints_approvaldeletioncallback) +- [CreateOrUpdate](#enclaveendpoints_createorupdate) +- [Delete](#enclaveendpoints_delete) +- [Get](#enclaveendpoints_get) +- [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 + +- [ApprovalCallback](#virtualenclave_approvalcallback) +- [ApprovalDeletionCallback](#virtualenclave_approvaldeletioncallback) +- [CreateOrUpdate](#virtualenclave_createorupdate) +- [Delete](#virtualenclave_delete) +- [GetByResourceGroup](#virtualenclave_getbyresourcegroup) +- [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.mission.models.ActionPerformed; +import com.azure.resourcemanager.mission.models.ApprovalStatus; +import com.azure.resourcemanager.mission.models.Approver; +import com.azure.resourcemanager.mission.models.RequestMetadata; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Approval CreateOrUpdate. + */ +public final class ApprovalCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Approvals_CreateOrUpdate.json + */ + /** + * Sample code: Approval_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.approvals() + .define("TestApprovals") + .withExistingResourceUri( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection") + .withParent1("string") + .withParent2("string") + .withRequestMetadata(new RequestMetadata().withResourceAction("string") + .withApprovalStatus(ApprovalStatus.APPROVED) + .withApprovalCallbackRoute("approvalCallback") + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}")) + .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")) + .create(); + } +} +``` + +### Approval_Delete + +```java +/** + * Samples for Approval Delete. + */ +public final class ApprovalDeleteSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Approvals_Delete. + * json + */ + /** + * Sample code: Approval_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalDelete(com.azure.resourcemanager.mission.MissionManager 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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Approvals_Get.json + */ + /** + * Sample code: Approval_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalGet(com.azure.resourcemanager.mission.MissionManager 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_InitiatorCallback + +```java +import com.azure.resourcemanager.mission.models.InitiatorCallbackRequest; +import com.azure.resourcemanager.mission.models.InitiatorCallbackRequestApprovalStatus; + +/** + * Samples for Approval InitiatorCallback. + */ +public final class ApprovalInitiatorCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Approvals_InitiatorCallback.json + */ + /** + * Sample code: Approval_InitiatorCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalInitiatorCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.approvals() + .initiatorCallback( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + "TestApprovals", + new InitiatorCallbackRequest().withApprovalStatus(InitiatorCallbackRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} +``` + +### Approval_ListByParent + +```java +/** + * Samples for Approval ListByParent. + */ +public final class ApprovalListByParentSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Approvals_ListByParent.json + */ + /** + * Sample code: Approval_ListByParent. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalListByParent(com.azure.resourcemanager.mission.MissionManager manager) { + manager.approvals() + .listByParent( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + com.azure.core.util.Context.NONE); + } +} +``` + +### Approval_Update + +```java +import com.azure.resourcemanager.mission.models.ActionPerformed; +import com.azure.resourcemanager.mission.models.ApprovalResource; +import com.azure.resourcemanager.mission.models.ApprovalStatus; +import com.azure.resourcemanager.mission.models.Approver; +import com.azure.resourcemanager.mission.models.RequestMetadataUpdate; +import com.azure.resourcemanager.mission.models.UpdateApprovalProperties; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Approval Update. + */ +public final class ApprovalUpdateSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Approvals_Update. + * json + */ + /** + * Sample code: Approval_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalUpdate(com.azure.resourcemanager.mission.MissionManager 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 UpdateApprovalProperties().withParent1("string") + .withParent2("string") + .withRequestMetadata(new RequestMetadataUpdate().withResourceAction("string") + .withApprovalStatus(ApprovalStatus.APPROVED) + .withApprovalCallbackRoute("approvalCallback") + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}")) + .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"))) + .apply(); + } +} +``` + +### Community_CheckAddressSpaceAvailability + +```java +import com.azure.resourcemanager.mission.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.mission.models.EnclaveVirtualNetwork; +import com.azure.resourcemanager.mission.models.SubnetConfiguration; +import java.util.Arrays; + +/** + * Samples for Community CheckAddressSpaceAvailability. + */ +public final class CommunityCheckAddressSpaceAvailabilitySamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Community_PostCheckAddressSpaceAvailability.json + */ + /** + * Sample code: Community_CheckAddressSpaceAvailability. + * + * @param manager Entry point to MissionManager. + */ + public static void + communityCheckAddressSpaceAvailability(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communities() + .checkAddressSpaceAvailabilityWithResponse("rgopenapi", "TestMyCommunity", + new CheckAddressSpaceAvailabilityRequest().withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/communities/TestMyCommunity") + .withEnclaveVirtualNetwork(new EnclaveVirtualNetwork().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true) + .withConnectToAzureServices(true)), + com.azure.core.util.Context.NONE); + } +} +``` + +### Community_CreateOrUpdate + +```java +import com.azure.resourcemanager.mission.models.ApprovalPolicy; +import com.azure.resourcemanager.mission.models.ApprovalSettings; +import com.azure.resourcemanager.mission.models.ApprovalSettingsConnectionUpdateMode; +import com.azure.resourcemanager.mission.models.GovernedServiceItem; +import com.azure.resourcemanager.mission.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.mission.models.GovernedServiceItemOption; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfiguration; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationJustification; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationMode; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentity; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.mission.models.MandatoryApprover; +import com.azure.resourcemanager.mission.models.Principal; +import com.azure.resourcemanager.mission.models.PrincipalType; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import com.azure.resourcemanager.mission.models.ServiceIdentifier; +import com.azure.resourcemanager.mission.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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Community_CreateOrUpdate.json + */ + /** + * Sample code: Community_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void communityCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communities() + .define("TestMyCommunity") + .withRegion("westcentralus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("sampletag", "samplevalue")) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) + .withAddressSpace("10.0.0.0/24") + .withDnsServers(Arrays.asList("azure.net")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withId(ServiceIdentifier.AKS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.APP_SERVICE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.CONTAINER_REGISTRY) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.KEY_VAULT) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.MICROSOFT_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.MONITORING) + .withOption(GovernedServiceItemOption.fromString("Not Applicable")) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.POSTGRE_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.SERVICE_BUS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.STORAGE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.AZURE_FIREWALLS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.INSIGHTS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.LOGIC) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.DATA_CONNECTORS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false))) + .withCommunityRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withId("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().withId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))))) + .withApprovalSettings(new ApprovalSettings().withEndpointCreation(ApprovalPolicy.NOT_REQUIRED) + .withEndpointUpdate(ApprovalPolicy.REQUIRED) + .withEndpointDeletion(ApprovalPolicy.NOT_REQUIRED) + .withConnectionCreation(ApprovalPolicy.REQUIRED) + .withConnectionUpdate(ApprovalPolicy.REQUIRED) + .withConnectionUpdateMode(ApprovalSettingsConnectionUpdateMode.MANUAL) + .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 MaintenanceModeConfiguration().withMode(MaintenanceModeConfigurationMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationJustification.OFF)) + .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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Community_Delete. + * json + */ + /** + * Sample code: Community_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void communityDelete(com.azure.resourcemanager.mission.MissionManager 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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Community_Get.json + */ + /** + * Sample code: Community_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void communityGet(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Community_ListBySubscription.json + */ + /** + * Sample code: Community_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void communityListBySubscription(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Community_ListByResourceGroup.json + */ + /** + * Sample code: Community_ListByResourceGroup. + * + * @param manager Entry point to MissionManager. + */ + public static void communityListByResourceGroup(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communities().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} +``` + +### Community_Update + +```java +import com.azure.resourcemanager.mission.models.CommunityResource; +import com.azure.resourcemanager.mission.models.GovernedServiceItem; +import com.azure.resourcemanager.mission.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.mission.models.GovernedServiceItemOption; +import com.azure.resourcemanager.mission.models.Principal; +import com.azure.resourcemanager.mission.models.PrincipalType; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import com.azure.resourcemanager.mission.models.ServiceIdentifier; +import com.azure.resourcemanager.mission.models.UpdateCommunityPatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Community Update. + */ +public final class CommunityUpdateSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Community_Update. + * json + */ + /** + * Sample code: Community_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void communityUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + CommunityResource resource = manager.communities() + .getByResourceGroupWithResponse("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new UpdateCommunityPatchProperties().withAddressSpace("10.0.0.0/24") + .withDnsServers(Arrays.asList("azure.net")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withId(ServiceIdentifier.AKS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.APP_SERVICE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.CONTAINER_REGISTRY) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.KEY_VAULT) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.MICROSOFT_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.MONITORING) + .withOption(GovernedServiceItemOption.fromString("Not Applicable")) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.POSTGRE_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.SERVICE_BUS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.STORAGE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.AZURE_FIREWALLS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.INSIGHTS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.LOGIC) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.DATA_CONNECTORS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false))) + .withCommunityRoleAssignments(Arrays.asList(new RoleAssignmentItem() + .withId("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().withId("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_ApprovalCallback + +```java +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for CommunityEndpoints ApprovalCallback. + */ +public final class CommunityEndpointsApprovalCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_PostApprovalCallback.json + */ + /** + * Sample code: CommunityEndpoints_ApprovalCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsApprovalCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints() + .approvalCallback("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityEndpoints_ApprovalDeletionCallback + +```java +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for CommunityEndpoints ApprovalDeletionCallback. + */ +public final class CommunityEndpointsApprovalDeletionCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_ApprovalDeletionCallback.json + */ + /** + * Sample code: CommunityEndpoints_ApprovalDeletionCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void + communityEndpointsApprovalDeletionCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints() + .approvalDeletionCallback( + "rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityEndpoints_CreateOrUpdate + +```java +import com.azure.resourcemanager.mission.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.mission.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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_CreateOrUpdate.json + */ + /** + * Sample code: CommunityEndpoints_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints() + .define("TestMyCommunityEndpoint") + .withRegion("West US") + .withExistingCommunity("rgopenapi", "TestMyCommunity") + .withTags(mapOf("sampletag", "samplevalue")) + .withRuleCollection(Arrays.asList(new CommunityEndpointDestinationRule().withDestination("foo.example.com") + .withPort("443") + .withDestinationType(DestinationType.FQDNTAG) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.TCP)) + .withTransitHubResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity/transitHubs/TestThName"))) + .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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_Delete.json + */ + /** + * Sample code: CommunityEndpoints_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsDelete(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_Get.json + */ + /** + * Sample code: CommunityEndpoints_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsGet(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityEndpoints_ListByCommunityResource + +```java +/** + * Samples for CommunityEndpoints ListByCommunityResource. + */ +public final class CommunityEndpointsListByCommunityResourceSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_ListByCommunityResource.json + */ + /** + * Sample code: CommunityEndpoints_ListByCommunityResource. + * + * @param manager Entry point to MissionManager. + */ + public static void + communityEndpointsListByCommunityResource(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_ListBySubscription.json + */ + /** + * Sample code: CommunityEndpoints_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsListBySubscription(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints().listBySubscription("TestMyCommunity", com.azure.core.util.Context.NONE); + } +} +``` + +### CommunityEndpoints_Update + +```java +import com.azure.resourcemanager.mission.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.mission.models.CommunityEndpointResource; +import com.azure.resourcemanager.mission.models.DestinationType; +import com.azure.resourcemanager.mission.models.UpdateCommunityEndpointPatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CommunityEndpoints Update. + */ +public final class CommunityEndpointsUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_Update.json + */ + /** + * Sample code: CommunityEndpoints_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + CommunityEndpointResource resource = manager.communityEndpoints() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new UpdateCommunityEndpointPatchProperties().withRuleCollection( + Arrays.asList(new CommunityEndpointDestinationRule().withDestination("foo.example.com") + .withPort("443") + .withDestinationType(DestinationType.FQDN) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.TCP)) + .withTransitHubResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity/transitHubs/TestThName")))) + .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_ApprovalCallback + +```java +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveConnection ApprovalCallback. + */ +public final class EnclaveConnectionApprovalCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_PostApprovalCallback.json + */ + /** + * Sample code: EnclaveConnection_ApprovalCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionApprovalCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections() + .approvalCallback("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_ApprovalDeletionCallback + +```java +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveConnection ApprovalDeletionCallback. + */ +public final class EnclaveConnectionApprovalDeletionCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_ApprovalDeletionCallback.json + */ + /** + * Sample code: EnclaveConnection_ApprovalDeletionCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void + enclaveConnectionApprovalDeletionCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections() + .approvalDeletionCallback("rgopenapi", "TestMyEnclaveConnection", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveConnection_CreateOrUpdate + +```java +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveConnection CreateOrUpdate. + */ +public final class EnclaveConnectionCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_CreateOrUpdate.json + */ + /** + * Sample code: EnclaveConnection_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections() + .define("TestMyEnclaveConnection") + .withRegion("West US") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("sampletag", "samplevalue")) + .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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_Delete.json + */ + /** + * Sample code: EnclaveConnection_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionDelete(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_Get.json + */ + /** + * Sample code: EnclaveConnection_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionGet(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclaveConnection", com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveConnection_List + +```java +/** + * Samples for EnclaveConnection List. + */ +public final class EnclaveConnectionListSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_ListBySubscription.json + */ + /** + * Sample code: EnclaveConnection_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionListBySubscription(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_ListByResourceGroup.json + */ + /** + * Sample code: EnclaveConnection_ListByResourceGroup. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionListByResourceGroup(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveConnection_Update + +```java +import com.azure.resourcemanager.mission.models.EnclaveConnectionResource; +import com.azure.resourcemanager.mission.models.UpdateEnclaveConnectionPatchProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveConnection Update. + */ +public final class EnclaveConnectionUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_Update.json + */ + /** + * Sample code: EnclaveConnection_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + EnclaveConnectionResource resource = manager.enclaveConnections() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclaveConnection", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new UpdateEnclaveConnectionPatchProperties().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")) + .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_ApprovalCallback + +```java +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveEndpoints ApprovalCallback. + */ +public final class EnclaveEndpointsApprovalCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_PostApprovalCallback.json + */ + /** + * Sample code: EnclaveEndpoints_ApprovalCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsApprovalCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints() + .approvalCallback("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveEndpoints_ApprovalDeletionCallback + +```java +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveEndpoints ApprovalDeletionCallback. + */ +public final class EnclaveEndpointsApprovalDeletionCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_ApprovalDeletionCallback.json + */ + /** + * Sample code: EnclaveEndpoints_ApprovalDeletionCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void + enclaveEndpointsApprovalDeletionCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints() + .approvalDeletionCallback( + "rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveEndpoints_CreateOrUpdate + +```java +import com.azure.resourcemanager.mission.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.mission.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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_CreateOrUpdate.json + */ + /** + * Sample code: EnclaveEndpoints_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints() + .define("TestMyEnclaveEndpoint") + .withRegion("West US") + .withExistingVirtualEnclave("rgopenapi", "TestMyEnclave") + .withTags(mapOf("sampletag", "samplevalue")) + .withRuleCollection( + Arrays.asList(new EnclaveEndpointDestinationRule().withName("54CEECEF-2C30-488E-946F-D20F414D99BA") + .withDestination("10.0.0.0/24") + .withPort("443") + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP)))) + .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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_Delete.json + */ + /** + * Sample code: EnclaveEndpoints_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsDelete(com.azure.resourcemanager.mission.MissionManager 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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/EnclaveEndpoints_Get + * .json + */ + /** + * Sample code: EnclaveEndpoints_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsGet(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveEndpoints_ListByEnclaveResource + +```java +/** + * Samples for EnclaveEndpoints ListByEnclaveResource. + */ +public final class EnclaveEndpointsListByEnclaveResourceSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_ListByEnclaveResource.json + */ + /** + * Sample code: EnclaveEndpoints_ListByEnclaveResource. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsListByEnclaveResource(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_ListBySubscription.json + */ + /** + * Sample code: EnclaveEndpoints_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsListBySubscription(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints().listBySubscription("TestMyEnclave", com.azure.core.util.Context.NONE); + } +} +``` + +### EnclaveEndpoints_Update + +```java +import com.azure.resourcemanager.mission.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.EnclaveEndpointProtocol; +import com.azure.resourcemanager.mission.models.EnclaveEndpointResource; +import com.azure.resourcemanager.mission.models.UpdateEnclaveEndpointPatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveEndpoints Update. + */ +public final class EnclaveEndpointsUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_Update.json + */ + /** + * Sample code: EnclaveEndpoints_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + EnclaveEndpointResource resource = manager.enclaveEndpoints() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new UpdateEnclaveEndpointPatchProperties().withRuleCollection( + Arrays.asList(new EnclaveEndpointDestinationRule().withName("54CEECEF-2C30-488E-946F-D20F414D99BA") + .withDestination("10.0.0.0/24") + .withPort("443") + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP))))) + .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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to MissionManager. + */ + public static void operationsList(com.azure.resourcemanager.mission.MissionManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### TransitHub_CreateOrUpdate + +```java +import com.azure.resourcemanager.mission.models.TransitHubState; +import com.azure.resourcemanager.mission.models.TransitOption; +import com.azure.resourcemanager.mission.models.TransitOptionParams; +import com.azure.resourcemanager.mission.models.TransitOptionType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for TransitHub CreateOrUpdate. + */ +public final class TransitHubCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * TransitHub_CreateOrUpdate.json + */ + /** + * Sample code: TransitHub_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.transitHubs() + .define("TestThName") + .withRegion("westcentralus") + .withExistingCommunity("rgopenapi", "TestMyCommunity") + .withTags(mapOf("Tag1", "Value1")) + .withState(TransitHubState.PENDING_APPROVAL) + .withTransitOption(new TransitOption().withType(TransitOptionType.EXPRESS_ROUTE) + .withParams(new TransitOptionParams().withScaleUnits(1L))) + .withResourceCollection(Arrays.asList("resCollection")) + .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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/TransitHub_Delete. + * json + */ + /** + * Sample code: TransitHub_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubDelete(com.azure.resourcemanager.mission.MissionManager 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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/TransitHub_Get.json + */ + /** + * Sample code: TransitHub_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubGet(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * TransitHub_ListByCommunityResource.json + */ + /** + * Sample code: TransitHub_ListByCommunityResource. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubListByCommunityResource(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * TransitHub_ListBySubscription.json + */ + /** + * Sample code: TransitHub_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubListBySubscription(com.azure.resourcemanager.mission.MissionManager manager) { + manager.transitHubs().listBySubscription("TestMyCommunity", com.azure.core.util.Context.NONE); + } +} +``` + +### TransitHub_Update + +```java +import com.azure.resourcemanager.mission.models.TransitHubResource; +import com.azure.resourcemanager.mission.models.TransitHubState; +import com.azure.resourcemanager.mission.models.TransitOption; +import com.azure.resourcemanager.mission.models.TransitOptionParams; +import com.azure.resourcemanager.mission.models.TransitOptionType; +import com.azure.resourcemanager.mission.models.UpdateTransitHubPatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for TransitHub Update. + */ +public final class TransitHubUpdateSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/TransitHub_Update. + * json + */ + /** + * Sample code: TransitHub_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + TransitHubResource resource = manager.transitHubs() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestThName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key4278", "fakeTokenPlaceholder")) + .withProperties(new UpdateTransitHubPatchProperties().withState(TransitHubState.PENDING_APPROVAL) + .withTransitOption(new TransitOption().withType(TransitOptionType.EXPRESS_ROUTE) + .withParams(new TransitOptionParams().withScaleUnits(1L))) + .withResourceCollection(Arrays.asList("resCollection"))) + .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_ApprovalCallback + +```java +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for VirtualEnclave ApprovalCallback. + */ +public final class VirtualEnclaveApprovalCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_PostApprovalCallback.json + */ + /** + * Sample code: VirtualEnclave_ApprovalCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveApprovalCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves() + .approvalCallback("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_ApprovalDeletionCallback + +```java +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for VirtualEnclave ApprovalDeletionCallback. + */ +public final class VirtualEnclaveApprovalDeletionCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_PostApprovalDeletionCallback.json + */ + /** + * Sample code: VirtualEnclave_ApprovalDeletionCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void + virtualEnclaveApprovalDeletionCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves() + .approvalDeletionCallback("rgopenapi", "TestMyEnclave", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualEnclave_CreateOrUpdate + +```java +import com.azure.resourcemanager.mission.models.DiagnosticDestination; +import com.azure.resourcemanager.mission.models.EnclaveDefaultSettings; +import com.azure.resourcemanager.mission.models.EnclaveVirtualNetwork; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfiguration; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationJustification; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationMode; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentity; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.mission.models.Principal; +import com.azure.resourcemanager.mission.models.PrincipalType; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import com.azure.resourcemanager.mission.models.SubnetConfiguration; +import com.azure.resourcemanager.mission.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for VirtualEnclave CreateOrUpdate. + */ +public final class VirtualEnclaveCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_CreateOrUpdate.json + */ + /** + * Sample code: VirtualEnclave_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves() + .define("TestMyEnclave") + .withRegion("westcentralus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("Tag1", "Value1")) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) + .withEnclaveVirtualNetwork(new EnclaveVirtualNetwork().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true) + .withConnectToAzureServices(true)) + .withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/communities/TestMyCommunity") + .withEnclaveDefaultSettings(new EnclaveDefaultSettings().withKeyVaultResourceId("fakeTokenPlaceholder") + .withStorageAccountResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Storage/storageAccounts/TestMyStorageAccount") + .withLogAnalyticsResourceIdCollection(Arrays.asList( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.OperationalInsights/workspaces/TestMyLogA1", + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.OperationalInsights/workspaces/TestMyLogA2")) + .withDiagnosticDestination(DiagnosticDestination.BOTH)) + .withResourceCollection(Arrays.asList()) + .withMaintenanceModeConfiguration( + new MaintenanceModeConfiguration().withMode(MaintenanceModeConfigurationMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationJustification.OFF)) + .withBastionEnabled(true) + .withEnclaveRoleAssignments( + Arrays.asList( + new RoleAssignmentItem().withId("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().withId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER))))) + .withWorkloadRoleAssignments( + Arrays.asList( + new RoleAssignmentItem().withId("d73bb868-a0df-4d4d-bd69-98a00b01fccb") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))), + new RoleAssignmentItem().withId("fb879df8-f326-4884-b1cf-06f3ad86be52") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))))) + .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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_Delete.json + */ + /** + * Sample code: VirtualEnclave_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveDelete(com.azure.resourcemanager.mission.MissionManager 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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/VirtualEnclave_Get. + * json + */ + /** + * Sample code: VirtualEnclave_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveGet(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualEnclave_List + +```java +/** + * Samples for VirtualEnclave List. + */ +public final class VirtualEnclaveListSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_ListBySubscription.json + */ + /** + * Sample code: VirtualEnclave_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveListBySubscription(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_ListByResourceGroup.json + */ + /** + * Sample code: VirtualEnclave_ListByResourceGroup. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveListByResourceGroup(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualEnclave_Update + +```java +import com.azure.resourcemanager.mission.models.DiagnosticDestination; +import com.azure.resourcemanager.mission.models.EnclaveDefaultSettings; +import com.azure.resourcemanager.mission.models.EnclaveResource; +import com.azure.resourcemanager.mission.models.EnclaveVirtualNetwork; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationUpdate; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationUpdateJustification; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationUpdateMode; +import com.azure.resourcemanager.mission.models.Principal; +import com.azure.resourcemanager.mission.models.PrincipalType; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import com.azure.resourcemanager.mission.models.SubnetConfiguration; +import com.azure.resourcemanager.mission.models.UpdateVirtualEnclavePatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for VirtualEnclave Update. + */ +public final class VirtualEnclaveUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_Update.json + */ + /** + * Sample code: VirtualEnclave_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + EnclaveResource resource = manager.virtualEnclaves() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("Tag1", "Value1")) + .withProperties(new UpdateVirtualEnclavePatchProperties() + .withEnclaveVirtualNetwork(new EnclaveVirtualNetwork().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true) + .withConnectToAzureServices(true)) + .withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/communities/TestMyCommunity") + .withEnclaveDefaultSettings(new EnclaveDefaultSettings().withKeyVaultResourceId("fakeTokenPlaceholder") + .withStorageAccountResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Storage/storageAccounts/TestMyStorageAccount") + .withLogAnalyticsResourceIdCollection(Arrays.asList( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.OperationalInsights/workspaces/TestMyLogA1", + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.OperationalInsights/workspaces/TestMyLogA2")) + .withDiagnosticDestination(DiagnosticDestination.BOTH)) + .withResourceCollection( + Arrays.asList("/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg")) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationUpdate() + .withMode(MaintenanceModeConfigurationUpdateMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationUpdateJustification.OFF)) + .withBastionEnabled(true) + .withEnclaveRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withId("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().withId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER))))) + .withWorkloadRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withId("d73bb868-a0df-4d4d-bd69-98a00b01fccb") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))), + new RoleAssignmentItem().withId("fb879df8-f326-4884-b1cf-06f3ad86be52") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP)))))) + .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 java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Workload CreateOrUpdate. + */ +public final class WorkloadCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Workload_CreateOrUpdate.json + */ + /** + * Sample code: Workload_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.workloads() + .define("TestMyWorkload") + .withRegion("westcentralus") + .withExistingVirtualEnclave("rgopenapi", "TestMyEnclave") + .withTags(mapOf("TestKey", "fakeTokenPlaceholder")) + .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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Workload_Delete.json + */ + /** + * Sample code: Workload_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadDelete(com.azure.resourcemanager.mission.MissionManager 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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Workload_Get.json + */ + /** + * Sample code: Workload_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadGet(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Workload_ListByEnclaveResource.json + */ + /** + * Sample code: Workload_ListByEnclaveResource. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadListByEnclaveResource(com.azure.resourcemanager.mission.MissionManager 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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Workload_ListBySubscription.json + */ + /** + * Sample code: Workload_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadListBySubscription(com.azure.resourcemanager.mission.MissionManager manager) { + manager.workloads().listBySubscription("TestMyEnclave", com.azure.core.util.Context.NONE); + } +} +``` + +### Workload_Update + +```java +import com.azure.resourcemanager.mission.models.UpdateWorkloadPatchProperties; +import com.azure.resourcemanager.mission.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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Workload_Update.json + */ + /** + * Sample code: Workload_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + WorkloadResource resource = manager.workloads() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyWorkload", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key9465", "fakeTokenPlaceholder")) + .withProperties(new UpdateWorkloadPatchProperties().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/mission/azure-resourcemanager-mission/pom.xml b/sdk/mission/azure-resourcemanager-mission/pom.xml new file mode 100644 index 000000000000..b6facd7badca --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-mission + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Mission Management + This package contains Microsoft Azure SDK for Mission 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 tag package-2024-12-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 + false + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/MissionManager.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/MissionManager.java new file mode 100644 index 000000000000..95718f1f742d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/MissionManager.java @@ -0,0 +1,410 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission; + +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.mission.fluent.MissionClient; +import com.azure.resourcemanager.mission.implementation.ApprovalsImpl; +import com.azure.resourcemanager.mission.implementation.CommunitiesImpl; +import com.azure.resourcemanager.mission.implementation.CommunityEndpointsImpl; +import com.azure.resourcemanager.mission.implementation.EnclaveConnectionsImpl; +import com.azure.resourcemanager.mission.implementation.EnclaveEndpointsImpl; +import com.azure.resourcemanager.mission.implementation.MissionClientBuilder; +import com.azure.resourcemanager.mission.implementation.OperationsImpl; +import com.azure.resourcemanager.mission.implementation.TransitHubsImpl; +import com.azure.resourcemanager.mission.implementation.VirtualEnclavesImpl; +import com.azure.resourcemanager.mission.implementation.WorkloadsImpl; +import com.azure.resourcemanager.mission.models.Approvals; +import com.azure.resourcemanager.mission.models.Communities; +import com.azure.resourcemanager.mission.models.CommunityEndpoints; +import com.azure.resourcemanager.mission.models.EnclaveConnections; +import com.azure.resourcemanager.mission.models.EnclaveEndpoints; +import com.azure.resourcemanager.mission.models.Operations; +import com.azure.resourcemanager.mission.models.TransitHubs; +import com.azure.resourcemanager.mission.models.VirtualEnclaves; +import com.azure.resourcemanager.mission.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 MissionManager. + * Microsoft Mission Resource Provider management API. + */ +public final class MissionManager { + private Approvals approvals; + + private Operations operations; + + private Communities communities; + + private CommunityEndpoints communityEndpoints; + + private TransitHubs transitHubs; + + private EnclaveConnections enclaveConnections; + + private VirtualEnclaves virtualEnclaves; + + private EnclaveEndpoints enclaveEndpoints; + + private Workloads workloads; + + private final MissionClient clientObject; + + private MissionManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new MissionClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Mission service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Mission service API instance. + */ + public static MissionManager 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 Mission service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Mission service API instance. + */ + public static MissionManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new MissionManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create MissionManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MissionManager.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-mission.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 Mission service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Mission service API instance. + */ + public MissionManager 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.mission") + .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 MissionManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * 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 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 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 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 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 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 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 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 wrapped service client MissionClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client MissionClient. + */ + public MissionClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/ApprovalsClient.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/ApprovalsClient.java new file mode 100644 index 000000000000..6b5c21f423fc --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/ApprovalsClient.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.models.ApprovalResourceInner; +import com.azure.resourcemanager.mission.fluent.models.InitiatorCallbackResponseInner; +import com.azure.resourcemanager.mission.models.ApprovalPatchResource; +import com.azure.resourcemanager.mission.models.InitiatorCallbackRequest; + +/** + * An instance of this class provides access to all the operations defined in ApprovalsClient. + */ +public interface ApprovalsClient { + /** + * 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); + + /** + * 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); + + /** + * 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, ApprovalPatchResource 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, ApprovalPatchResource 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, ApprovalPatchResource 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, ApprovalPatchResource 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InitiatorCallbackResponseInner> + beginInitiatorCallback(String resourceUri, String approvalName, InitiatorCallbackRequest 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, InitiatorCallbackResponseInner> + beginInitiatorCallback(String resourceUri, String approvalName, InitiatorCallbackRequest 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InitiatorCallbackResponseInner initiatorCallback(String resourceUri, String approvalName, + InitiatorCallbackRequest 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InitiatorCallbackResponseInner initiatorCallback(String resourceUri, String approvalName, + InitiatorCallbackRequest body, Context context); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/CommunitiesClient.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/CommunitiesClient.java new file mode 100644 index 000000000000..858e636d963f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/CommunitiesClient.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.models.CheckAddressSpaceAvailabilityResponseInner; +import com.azure.resourcemanager.mission.fluent.models.CommunityResourceInner; +import com.azure.resourcemanager.mission.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.mission.models.CommunityPatchResource; + +/** + * An instance of this class provides access to all the operations defined in CommunitiesClient. + */ +public interface CommunitiesClient { + /** + * 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); + + /** + * 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); + + /** + * 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, CommunityPatchResource 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, CommunityPatchResource 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, CommunityPatchResource 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, CommunityPatchResource 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); + + /** + * 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/CommunityEndpointsClient.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/CommunityEndpointsClient.java new file mode 100644 index 000000000000..d24cd1e03602 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/CommunityEndpointsClient.java @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.CommunityEndpointResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.CommunityEndpointPatchResource; + +/** + * An instance of this class provides access to all the operations defined in CommunityEndpointsClient. + */ +public interface CommunityEndpointsClient { + /** + * 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); + + /** + * 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); + + /** + * 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, + CommunityEndpointPatchResource 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, + CommunityEndpointPatchResource 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, + CommunityEndpointPatchResource 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, + CommunityEndpointPatchResource 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); + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalCallbackResponseInner approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalCallbackResponseInner approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalDeletionCallbackResponseInner approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/EnclaveConnectionsClient.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/EnclaveConnectionsClient.java new file mode 100644 index 000000000000..410feedf8241 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/EnclaveConnectionsClient.java @@ -0,0 +1,408 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.EnclaveConnectionResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.EnclaveConnectionPatchResource; + +/** + * An instance of this class provides access to all the operations defined in EnclaveConnectionsClient. + */ +public interface EnclaveConnectionsClient { + /** + * 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); + + /** + * 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); + + /** + * 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, EnclaveConnectionPatchResource 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, EnclaveConnectionPatchResource 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, + EnclaveConnectionPatchResource 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, + EnclaveConnectionPatchResource 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); + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalCallbackResponseInner> + beginApprovalCallback(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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalCallbackResponseInner approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalCallbackResponseInner approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalDeletionCallbackResponseInner approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/EnclaveEndpointsClient.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/EnclaveEndpointsClient.java new file mode 100644 index 000000000000..5a15e554e965 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/EnclaveEndpointsClient.java @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.EnclaveEndpointResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.EnclaveEndpointPatchResource; + +/** + * An instance of this class provides access to all the operations defined in EnclaveEndpointsClient. + */ +public interface EnclaveEndpointsClient { + /** + * 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); + + /** + * 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); + + /** + * 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, + EnclaveEndpointPatchResource 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, + EnclaveEndpointPatchResource 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, + EnclaveEndpointPatchResource 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, + EnclaveEndpointPatchResource 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); + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalCallbackResponseInner approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalCallbackResponseInner approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalDeletionCallbackResponseInner approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/MissionClient.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/MissionClient.java new file mode 100644 index 000000000000..b51479f8e13c --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/MissionClient.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for MissionClient class. + */ +public interface MissionClient { + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * 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 ApprovalsClient object to access its operations. + * + * @return the ApprovalsClient object. + */ + ApprovalsClient getApprovals(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the CommunitiesClient object to access its operations. + * + * @return the CommunitiesClient object. + */ + CommunitiesClient getCommunities(); + + /** + * Gets the CommunityEndpointsClient object to access its operations. + * + * @return the CommunityEndpointsClient object. + */ + CommunityEndpointsClient getCommunityEndpoints(); + + /** + * 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 VirtualEnclavesClient object to access its operations. + * + * @return the VirtualEnclavesClient object. + */ + VirtualEnclavesClient getVirtualEnclaves(); + + /** + * Gets the EnclaveEndpointsClient object to access its operations. + * + * @return the EnclaveEndpointsClient object. + */ + EnclaveEndpointsClient getEnclaveEndpoints(); + + /** + * Gets the WorkloadsClient object to access its operations. + * + * @return the WorkloadsClient object. + */ + WorkloadsClient getWorkloads(); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/OperationsClient.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/OperationsClient.java new file mode 100644 index 000000000000..e9cc9b15ab01 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/TransitHubsClient.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/TransitHubsClient.java new file mode 100644 index 000000000000..e14de723fa4b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/TransitHubsClient.java @@ -0,0 +1,294 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.models.TransitHubResourceInner; +import com.azure.resourcemanager.mission.models.TransitHubPatchResource; + +/** + * An instance of this class provides access to all the operations defined in TransitHubsClient. + */ +public interface TransitHubsClient { + /** + * 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); + + /** + * 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); + + /** + * 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, TransitHubPatchResource 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, TransitHubPatchResource 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, + TransitHubPatchResource 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, + TransitHubPatchResource 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); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/VirtualEnclavesClient.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/VirtualEnclavesClient.java new file mode 100644 index 000000000000..4fab9b26493b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/VirtualEnclavesClient.java @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.EnclaveResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.VirtualEnclavePatchResource; + +/** + * An instance of this class provides access to all the operations defined in VirtualEnclavesClient. + */ +public interface VirtualEnclavesClient { + /** + * 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); + + /** + * 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); + + /** + * 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, VirtualEnclavePatchResource 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, VirtualEnclavePatchResource 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, + VirtualEnclavePatchResource 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, + VirtualEnclavePatchResource 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); + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalCallbackResponseInner> + beginApprovalCallback(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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalCallbackResponseInner approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalCallbackResponseInner approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalDeletionCallbackResponseInner approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/WorkloadsClient.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/WorkloadsClient.java new file mode 100644 index 000000000000..49a63019ebc3 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/WorkloadsClient.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.models.WorkloadResourceInner; +import com.azure.resourcemanager.mission.models.WorkloadPatchResource; + +/** + * An instance of this class provides access to all the operations defined in WorkloadsClient. + */ +public interface WorkloadsClient { + /** + * 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); + + /** + * 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); + + /** + * 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, WorkloadPatchResource 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, WorkloadPatchResource 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, + WorkloadPatchResource 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, + WorkloadPatchResource 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); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalCallbackResponseInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalCallbackResponseInner.java new file mode 100644 index 000000000000..c4efbb541b4d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalCallbackResponseInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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. + */ +@Fluent +public final class ApprovalCallbackResponseInner implements JsonSerializable { + /* + * Confirmation message indicating the result of the operation. + */ + private String message; + + /** + * Creates an instance of ApprovalCallbackResponseInner class. + */ + public ApprovalCallbackResponseInner() { + } + + /** + * Get the message property: Confirmation message indicating the result of the operation. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Confirmation message indicating the result of the operation. + * + * @param message the message value to set. + * @return the ApprovalCallbackResponseInner object itself. + */ + public ApprovalCallbackResponseInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (message() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property message in model ApprovalCallbackResponseInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApprovalCallbackResponseInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalCallbackResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalCallbackResponseInner 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 ApprovalCallbackResponseInner. + */ + public static ApprovalCallbackResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalCallbackResponseInner deserializedApprovalCallbackResponseInner + = new ApprovalCallbackResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("message".equals(fieldName)) { + deserializedApprovalCallbackResponseInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalCallbackResponseInner; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalDeletionCallbackResponseInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalDeletionCallbackResponseInner.java new file mode 100644 index 000000000000..f4dcec6ec861 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalDeletionCallbackResponseInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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 approvalDeletionCallbackRequest. + */ +@Fluent +public final class ApprovalDeletionCallbackResponseInner + implements JsonSerializable { + /* + * Confirmation message indicating the result of the operation. + */ + private String message; + + /** + * Creates an instance of ApprovalDeletionCallbackResponseInner class. + */ + public ApprovalDeletionCallbackResponseInner() { + } + + /** + * Get the message property: Confirmation message indicating the result of the operation. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Confirmation message indicating the result of the operation. + * + * @param message the message value to set. + * @return the ApprovalDeletionCallbackResponseInner object itself. + */ + public ApprovalDeletionCallbackResponseInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (message() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property message in model ApprovalDeletionCallbackResponseInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApprovalDeletionCallbackResponseInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalDeletionCallbackResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalDeletionCallbackResponseInner 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 ApprovalDeletionCallbackResponseInner. + */ + public static ApprovalDeletionCallbackResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalDeletionCallbackResponseInner deserializedApprovalDeletionCallbackResponseInner + = new ApprovalDeletionCallbackResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("message".equals(fieldName)) { + deserializedApprovalDeletionCallbackResponseInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalDeletionCallbackResponseInner; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalProperties.java new file mode 100644 index 000000000000..236c38a24695 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalProperties.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.models.Approver; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.RequestMetadata; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * Approvals Resource Properties. + */ +@Fluent +public final class ApprovalProperties implements JsonSerializable { + /* + * Provisioning State. + */ + private ProvisioningState provisioningState; + + /* + * Parameter for optimizing query results + */ + private String parent1; + + /* + * Parameter for optimizing query results + */ + private String parent2; + + /* + * Request metadata for the approval request. + */ + private RequestMetadata requestMetadata; + + /* + * 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; + + /** + * 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 parent1 property: Parameter for optimizing query results. + * + * @return the parent1 value. + */ + public String parent1() { + return this.parent1; + } + + /** + * Set the parent1 property: Parameter for optimizing query results. + * + * @param parent1 the parent1 value to set. + * @return the ApprovalProperties object itself. + */ + public ApprovalProperties withParent1(String parent1) { + this.parent1 = parent1; + return this; + } + + /** + * Get the parent2 property: Parameter for optimizing query results. + * + * @return the parent2 value. + */ + public String parent2() { + return this.parent2; + } + + /** + * Set the parent2 property: Parameter for optimizing query results. + * + * @param parent2 the parent2 value to set. + * @return the ApprovalProperties object itself. + */ + public ApprovalProperties withParent2(String parent2) { + this.parent2 = parent2; + 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; + } + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (requestMetadata() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property requestMetadata in model ApprovalProperties")); + } else { + requestMetadata().validate(); + } + if (approvers() != null) { + approvers().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApprovalProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("requestMetadata", this.requestMetadata); + jsonWriter.writeStringField("parent1", this.parent1); + jsonWriter.writeStringField("parent2", this.parent2); + 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 ("parent1".equals(fieldName)) { + deserializedApprovalProperties.parent1 = reader.getString(); + } else if ("parent2".equals(fieldName)) { + deserializedApprovalProperties.parent2 = 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalResourceInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalResourceInner.java new file mode 100644 index 000000000000..b3de614bbeb7 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/ApprovalResourceInner.java @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.models.Approver; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.RequestMetadata; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * Approval Model Resource. + */ +@Fluent +public final class ApprovalResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private ApprovalProperties innerProperties; + + /* + * 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 innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private ApprovalProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the parent1 property: Parameter for optimizing query results. + * + * @return the parent1 value. + */ + public String parent1() { + return this.innerProperties() == null ? null : this.innerProperties().parent1(); + } + + /** + * Set the parent1 property: Parameter for optimizing query results. + * + * @param parent1 the parent1 value to set. + * @return the ApprovalResourceInner object itself. + */ + public ApprovalResourceInner withParent1(String parent1) { + if (this.innerProperties() == null) { + this.innerProperties = new ApprovalProperties(); + } + this.innerProperties().withParent1(parent1); + return this; + } + + /** + * Get the parent2 property: Parameter for optimizing query results. + * + * @return the parent2 value. + */ + public String parent2() { + return this.innerProperties() == null ? null : this.innerProperties().parent2(); + } + + /** + * Set the parent2 property: Parameter for optimizing query results. + * + * @param parent2 the parent2 value to set. + * @return the ApprovalResourceInner object itself. + */ + public ApprovalResourceInner withParent2(String parent2) { + if (this.innerProperties() == null) { + this.innerProperties = new ApprovalProperties(); + } + this.innerProperties().withParent2(parent2); + return this; + } + + /** + * Get the requestMetadata property: Request metadata for the approval request. + * + * @return the requestMetadata value. + */ + public RequestMetadata requestMetadata() { + return this.innerProperties() == null ? null : this.innerProperties().requestMetadata(); + } + + /** + * Set the requestMetadata property: Request metadata for the approval request. + * + * @param requestMetadata the requestMetadata value to set. + * @return the ApprovalResourceInner object itself. + */ + public ApprovalResourceInner withRequestMetadata(RequestMetadata requestMetadata) { + if (this.innerProperties() == null) { + this.innerProperties = new ApprovalProperties(); + } + this.innerProperties().withRequestMetadata(requestMetadata); + return this; + } + + /** + * Get the approvers property: List of approvers for the approval request. + * + * @return the approvers value. + */ + public List approvers() { + return this.innerProperties() == null ? null : this.innerProperties().approvers(); + } + + /** + * Set the approvers property: List of approvers for the approval request. + * + * @param approvers the approvers value to set. + * @return the ApprovalResourceInner object itself. + */ + public ApprovalResourceInner withApprovers(List approvers) { + if (this.innerProperties() == null) { + this.innerProperties = new ApprovalProperties(); + } + this.innerProperties().withApprovers(approvers); + return this; + } + + /** + * Get the ticketId property: Ticket ID for the approval request. + * + * @return the ticketId value. + */ + public String ticketId() { + return this.innerProperties() == null ? null : this.innerProperties().ticketId(); + } + + /** + * Set the ticketId property: Ticket ID for the approval request. + * + * @param ticketId the ticketId value to set. + * @return the ApprovalResourceInner object itself. + */ + public ApprovalResourceInner withTicketId(String ticketId) { + if (this.innerProperties() == null) { + this.innerProperties = new ApprovalProperties(); + } + this.innerProperties().withTicketId(ticketId); + return this; + } + + /** + * Get the createdAt property: Approval request creation time. + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.innerProperties() == null ? null : this.innerProperties().createdAt(); + } + + /** + * Set the createdAt property: Approval request creation time. + * + * @param createdAt the createdAt value to set. + * @return the ApprovalResourceInner object itself. + */ + public ApprovalResourceInner withCreatedAt(OffsetDateTime createdAt) { + if (this.innerProperties() == null) { + this.innerProperties = new ApprovalProperties(); + } + this.innerProperties().withCreatedAt(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.innerProperties() == null ? null : this.innerProperties().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 ApprovalResourceInner object itself. + */ + public ApprovalResourceInner withStateChangedAt(OffsetDateTime stateChangedAt) { + if (this.innerProperties() == null) { + this.innerProperties = new ApprovalProperties(); + } + this.innerProperties().withStateChangedAt(stateChangedAt); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + 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.innerProperties = ApprovalProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedApprovalResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalResourceInner; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CheckAddressSpaceAvailabilityResponseInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CheckAddressSpaceAvailabilityResponseInner.java new file mode 100644 index 000000000000..91d3333252d6 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CheckAddressSpaceAvailabilityResponseInner.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.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; + +/** + * Response of availability of the requested address space. + */ +@Fluent +public final class CheckAddressSpaceAvailabilityResponseInner + implements JsonSerializable { + /* + * Boolean representing whether the address space is available. + */ + private boolean value; + + /** + * Creates an instance of CheckAddressSpaceAvailabilityResponseInner class. + */ + public CheckAddressSpaceAvailabilityResponseInner() { + } + + /** + * Get the value property: Boolean representing whether the address space is available. + * + * @return the value value. + */ + public boolean value() { + return this.value; + } + + /** + * Set the value property: Boolean representing whether the address space is available. + * + * @param value the value value to set. + * @return the CheckAddressSpaceAvailabilityResponseInner object itself. + */ + public CheckAddressSpaceAvailabilityResponseInner withValue(boolean value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityEndpointProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityEndpointProperties.java new file mode 100644 index 000000000000..bb102c9d7edf --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityEndpointProperties.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.ProvisioningState; +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; + } + + /** + * Set the resourceCollection property: List of resource ids created by community endpoint. + * + * @param resourceCollection the resourceCollection value to set. + * @return the CommunityEndpointProperties object itself. + */ + public CommunityEndpointProperties withResourceCollection(List resourceCollection) { + this.resourceCollection = resourceCollection; + return this; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ruleCollection() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property ruleCollection in model CommunityEndpointProperties")); + } else { + ruleCollection().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CommunityEndpointProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ruleCollection", this.ruleCollection, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("resourceCollection", this.resourceCollection, + (writer, element) -> writer.writeString(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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityEndpointResourceInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityEndpointResourceInner.java new file mode 100644 index 000000000000..df77c2cba0f8 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityEndpointResourceInner.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * CommunityEndpoint Model Resource. + */ +@Fluent +public final class CommunityEndpointResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private CommunityEndpointProperties innerProperties; + + /* + * 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 innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private CommunityEndpointProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Get the ruleCollection property: Community Endpoint Rule Collection. + * + * @return the ruleCollection value. + */ + public List ruleCollection() { + return this.innerProperties() == null ? null : this.innerProperties().ruleCollection(); + } + + /** + * Set the ruleCollection property: Community Endpoint Rule Collection. + * + * @param ruleCollection the ruleCollection value to set. + * @return the CommunityEndpointResourceInner object itself. + */ + public CommunityEndpointResourceInner withRuleCollection(List ruleCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityEndpointProperties(); + } + this.innerProperties().withRuleCollection(ruleCollection); + return this; + } + + /** + * Get the resourceCollection property: List of resource ids created by community endpoint. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.innerProperties() == null ? null : this.innerProperties().resourceCollection(); + } + + /** + * Set the resourceCollection property: List of resource ids created by community endpoint. + * + * @param resourceCollection the resourceCollection value to set. + * @return the CommunityEndpointResourceInner object itself. + */ + public CommunityEndpointResourceInner withResourceCollection(List resourceCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityEndpointProperties(); + } + this.innerProperties().withResourceCollection(resourceCollection); + return this; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@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.innerProperties); + 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.innerProperties + = CommunityEndpointProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCommunityEndpointResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityEndpointResourceInner; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityProperties.java new file mode 100644 index 000000000000..6eefe30f4712 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityProperties.java @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.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 com.azure.resourcemanager.mission.models.ApprovalSettings; +import com.azure.resourcemanager.mission.models.GovernedServiceItem; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfiguration; +import com.azure.resourcemanager.mission.models.ManagedResourceGroupConfiguration; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +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 configuration. + */ + private ManagedResourceGroupConfiguration managedResourceGroupConfiguration; + + /* + * List of services governed by a community. + */ + private List governedServiceList; + + /* + * Community role assignments + */ + private List communityRoleAssignments; + + /* + * Approval requirements for various actions on the community's resources. + */ + private ApprovalSettings approvalSettings; + + /* + * Maintenance Mode configuration. + */ + private MaintenanceModeConfiguration 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 managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @return the managedResourceGroupConfiguration value. + */ + public ManagedResourceGroupConfiguration managedResourceGroupConfiguration() { + return this.managedResourceGroupConfiguration; + } + + /** + * Set the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @param managedResourceGroupConfiguration the managedResourceGroupConfiguration value to set. + * @return the CommunityProperties object itself. + */ + public CommunityProperties + withManagedResourceGroupConfiguration(ManagedResourceGroupConfiguration managedResourceGroupConfiguration) { + this.managedResourceGroupConfiguration = managedResourceGroupConfiguration; + 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 CommunityProperties object itself. + */ + public CommunityProperties withGovernedServiceList(List governedServiceList) { + this.governedServiceList = governedServiceList; + 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 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 MaintenanceModeConfiguration 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(MaintenanceModeConfiguration maintenanceModeConfiguration) { + this.maintenanceModeConfiguration = maintenanceModeConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (managedResourceGroupConfiguration() != null) { + managedResourceGroupConfiguration().validate(); + } + if (governedServiceList() != null) { + governedServiceList().forEach(e -> e.validate()); + } + if (communityRoleAssignments() != null) { + communityRoleAssignments().forEach(e -> e.validate()); + } + if (approvalSettings() != null) { + approvalSettings().validate(); + } + if (maintenanceModeConfiguration() != null) { + maintenanceModeConfiguration().validate(); + } + } + + /** + * {@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.writeJsonField("managedResourceGroupConfiguration", this.managedResourceGroupConfiguration); + jsonWriter.writeArrayField("governedServiceList", this.governedServiceList, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("communityRoleAssignments", this.communityRoleAssignments, + (writer, element) -> writer.writeJson(element)); + 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 ("managedResourceGroupConfiguration".equals(fieldName)) { + deserializedCommunityProperties.managedResourceGroupConfiguration + = ManagedResourceGroupConfiguration.fromJson(reader); + } else if ("governedServiceList".equals(fieldName)) { + List governedServiceList + = reader.readArray(reader1 -> GovernedServiceItem.fromJson(reader1)); + deserializedCommunityProperties.governedServiceList = governedServiceList; + } else if ("communityRoleAssignments".equals(fieldName)) { + List communityRoleAssignments + = reader.readArray(reader1 -> RoleAssignmentItem.fromJson(reader1)); + deserializedCommunityProperties.communityRoleAssignments = communityRoleAssignments; + } else if ("approvalSettings".equals(fieldName)) { + deserializedCommunityProperties.approvalSettings = ApprovalSettings.fromJson(reader); + } else if ("maintenanceModeConfiguration".equals(fieldName)) { + deserializedCommunityProperties.maintenanceModeConfiguration + = MaintenanceModeConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityProperties; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityResourceInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityResourceInner.java new file mode 100644 index 000000000000..58e477f6b28e --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/CommunityResourceInner.java @@ -0,0 +1,400 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.models.ApprovalSettings; +import com.azure.resourcemanager.mission.models.GovernedServiceItem; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfiguration; +import com.azure.resourcemanager.mission.models.ManagedResourceGroupConfiguration; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentity; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Community Model Resource. + */ +@Fluent +public final class CommunityResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private CommunityProperties innerProperties; + + /* + * 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 innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private CommunityProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Get the addressSpace property: Address Space. + * + * @return the addressSpace value. + */ + public String addressSpace() { + return this.innerProperties() == null ? null : this.innerProperties().addressSpace(); + } + + /** + * Set the addressSpace property: Address Space. + * + * @param addressSpace the addressSpace value to set. + * @return the CommunityResourceInner object itself. + */ + public CommunityResourceInner withAddressSpace(String addressSpace) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityProperties(); + } + this.innerProperties().withAddressSpace(addressSpace); + return this; + } + + /** + * Get the dnsServers property: Dns Servers. + * + * @return the dnsServers value. + */ + public List dnsServers() { + return this.innerProperties() == null ? null : this.innerProperties().dnsServers(); + } + + /** + * Set the dnsServers property: Dns Servers. + * + * @param dnsServers the dnsServers value to set. + * @return the CommunityResourceInner object itself. + */ + public CommunityResourceInner withDnsServers(List dnsServers) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityProperties(); + } + this.innerProperties().withDnsServers(dnsServers); + return this; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the resourceCollection property: List of resource ids created by communities. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.innerProperties() == null ? null : this.innerProperties().resourceCollection(); + } + + /** + * Get the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @return the managedResourceGroupConfiguration value. + */ + public ManagedResourceGroupConfiguration managedResourceGroupConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().managedResourceGroupConfiguration(); + } + + /** + * Set the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @param managedResourceGroupConfiguration the managedResourceGroupConfiguration value to set. + * @return the CommunityResourceInner object itself. + */ + public CommunityResourceInner + withManagedResourceGroupConfiguration(ManagedResourceGroupConfiguration managedResourceGroupConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityProperties(); + } + this.innerProperties().withManagedResourceGroupConfiguration(managedResourceGroupConfiguration); + return this; + } + + /** + * Get the governedServiceList property: List of services governed by a community. + * + * @return the governedServiceList value. + */ + public List governedServiceList() { + return this.innerProperties() == null ? null : this.innerProperties().governedServiceList(); + } + + /** + * Set the governedServiceList property: List of services governed by a community. + * + * @param governedServiceList the governedServiceList value to set. + * @return the CommunityResourceInner object itself. + */ + public CommunityResourceInner withGovernedServiceList(List governedServiceList) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityProperties(); + } + this.innerProperties().withGovernedServiceList(governedServiceList); + return this; + } + + /** + * Get the communityRoleAssignments property: Community role assignments. + * + * @return the communityRoleAssignments value. + */ + public List communityRoleAssignments() { + return this.innerProperties() == null ? null : this.innerProperties().communityRoleAssignments(); + } + + /** + * Set the communityRoleAssignments property: Community role assignments. + * + * @param communityRoleAssignments the communityRoleAssignments value to set. + * @return the CommunityResourceInner object itself. + */ + public CommunityResourceInner withCommunityRoleAssignments(List communityRoleAssignments) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityProperties(); + } + this.innerProperties().withCommunityRoleAssignments(communityRoleAssignments); + 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.innerProperties() == null ? null : this.innerProperties().approvalSettings(); + } + + /** + * Set the approvalSettings property: Approval requirements for various actions on the community's resources. + * + * @param approvalSettings the approvalSettings value to set. + * @return the CommunityResourceInner object itself. + */ + public CommunityResourceInner withApprovalSettings(ApprovalSettings approvalSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityProperties(); + } + this.innerProperties().withApprovalSettings(approvalSettings); + return this; + } + + /** + * Get the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @return the maintenanceModeConfiguration value. + */ + public MaintenanceModeConfiguration maintenanceModeConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceModeConfiguration(); + } + + /** + * Set the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @param maintenanceModeConfiguration the maintenanceModeConfiguration value to set. + * @return the CommunityResourceInner object itself. + */ + public CommunityResourceInner + withMaintenanceModeConfiguration(MaintenanceModeConfiguration maintenanceModeConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new CommunityProperties(); + } + this.innerProperties().withMaintenanceModeConfiguration(maintenanceModeConfiguration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@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.innerProperties); + 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.innerProperties = 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveConnectionProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveConnectionProperties.java new file mode 100644 index 000000000000..1ccc78b1ca35 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveConnectionProperties.java @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.models.EnclaveConnectionState; +import com.azure.resourcemanager.mission.models.ProvisioningState; +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; + + /* + * Source IP group Resource Id. + */ + private String ipGroup; + + /* + * 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; + } + + /** + * Set the state property: The state of the enclaveConnection. + * + * @param state the state value to set. + * @return the EnclaveConnectionProperties object itself. + */ + public EnclaveConnectionProperties withState(EnclaveConnectionState state) { + this.state = state; + return this; + } + + /** + * 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 ipGroup property: Source IP group Resource Id. + * + * @return the ipGroup value. + */ + public String ipGroup() { + return this.ipGroup; + } + + /** + * Set the ipGroup property: Source IP group Resource Id. + * + * @param ipGroup the ipGroup value to set. + * @return the EnclaveConnectionProperties object itself. + */ + public EnclaveConnectionProperties withIpGroup(String ipGroup) { + this.ipGroup = ipGroup; + 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; + } + + /** + * Set the resourceCollection property: List of resource ids modified by enclave Connections. + * + * @param resourceCollection the resourceCollection value to set. + * @return the EnclaveConnectionProperties object itself. + */ + public EnclaveConnectionProperties withResourceCollection(List resourceCollection) { + this.resourceCollection = resourceCollection; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (communityResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property communityResourceId in model EnclaveConnectionProperties")); + } + if (sourceResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceResourceId in model EnclaveConnectionProperties")); + } + if (destinationEndpointId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property destinationEndpointId in model EnclaveConnectionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EnclaveConnectionProperties.class); + + /** + * {@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("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeStringField("sourceCidr", this.sourceCidr); + jsonWriter.writeStringField("ipGroup", this.ipGroup); + jsonWriter.writeArrayField("resourceCollection", this.resourceCollection, + (writer, element) -> writer.writeString(element)); + 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 ("ipGroup".equals(fieldName)) { + deserializedEnclaveConnectionProperties.ipGroup = 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveConnectionResourceInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveConnectionResourceInner.java new file mode 100644 index 000000000000..cab19a9f5f90 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveConnectionResourceInner.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.models.EnclaveConnectionState; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * EnclaveConnection Model Resource. + */ +@Fluent +public final class EnclaveConnectionResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private EnclaveConnectionProperties innerProperties; + + /* + * 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 innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private EnclaveConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Get the state property: The state of the enclaveConnection. + * + * @return the state value. + */ + public EnclaveConnectionState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: The state of the enclaveConnection. + * + * @param state the state value to set. + * @return the EnclaveConnectionResourceInner object itself. + */ + public EnclaveConnectionResourceInner withState(EnclaveConnectionState state) { + if (this.innerProperties() == null) { + this.innerProperties = new EnclaveConnectionProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the communityResourceId property: Community Resource Id. + * + * @return the communityResourceId value. + */ + public String communityResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().communityResourceId(); + } + + /** + * Set the communityResourceId property: Community Resource Id. + * + * @param communityResourceId the communityResourceId value to set. + * @return the EnclaveConnectionResourceInner object itself. + */ + public EnclaveConnectionResourceInner withCommunityResourceId(String communityResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new EnclaveConnectionProperties(); + } + this.innerProperties().withCommunityResourceId(communityResourceId); + return this; + } + + /** + * Get the sourceResourceId property: Source Resource Id. + * + * @return the sourceResourceId value. + */ + public String sourceResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().sourceResourceId(); + } + + /** + * Set the sourceResourceId property: Source Resource Id. + * + * @param sourceResourceId the sourceResourceId value to set. + * @return the EnclaveConnectionResourceInner object itself. + */ + public EnclaveConnectionResourceInner withSourceResourceId(String sourceResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new EnclaveConnectionProperties(); + } + this.innerProperties().withSourceResourceId(sourceResourceId); + return this; + } + + /** + * Get the sourceCidr property: Source CIDR. + * + * @return the sourceCidr value. + */ + public String sourceCidr() { + return this.innerProperties() == null ? null : this.innerProperties().sourceCidr(); + } + + /** + * Set the sourceCidr property: Source CIDR. + * + * @param sourceCidr the sourceCidr value to set. + * @return the EnclaveConnectionResourceInner object itself. + */ + public EnclaveConnectionResourceInner withSourceCidr(String sourceCidr) { + if (this.innerProperties() == null) { + this.innerProperties = new EnclaveConnectionProperties(); + } + this.innerProperties().withSourceCidr(sourceCidr); + return this; + } + + /** + * Get the ipGroup property: Source IP group Resource Id. + * + * @return the ipGroup value. + */ + public String ipGroup() { + return this.innerProperties() == null ? null : this.innerProperties().ipGroup(); + } + + /** + * Set the ipGroup property: Source IP group Resource Id. + * + * @param ipGroup the ipGroup value to set. + * @return the EnclaveConnectionResourceInner object itself. + */ + public EnclaveConnectionResourceInner withIpGroup(String ipGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new EnclaveConnectionProperties(); + } + this.innerProperties().withIpGroup(ipGroup); + return this; + } + + /** + * Get the destinationEndpointId property: Destination Endpoint Resource Id. + * + * @return the destinationEndpointId value. + */ + public String destinationEndpointId() { + return this.innerProperties() == null ? null : this.innerProperties().destinationEndpointId(); + } + + /** + * Set the destinationEndpointId property: Destination Endpoint Resource Id. + * + * @param destinationEndpointId the destinationEndpointId value to set. + * @return the EnclaveConnectionResourceInner object itself. + */ + public EnclaveConnectionResourceInner withDestinationEndpointId(String destinationEndpointId) { + if (this.innerProperties() == null) { + this.innerProperties = new EnclaveConnectionProperties(); + } + this.innerProperties().withDestinationEndpointId(destinationEndpointId); + return this; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the resourceCollection property: List of resource ids modified by enclave Connections. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.innerProperties() == null ? null : this.innerProperties().resourceCollection(); + } + + /** + * Set the resourceCollection property: List of resource ids modified by enclave Connections. + * + * @param resourceCollection the resourceCollection value to set. + * @return the EnclaveConnectionResourceInner object itself. + */ + public EnclaveConnectionResourceInner withResourceCollection(List resourceCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new EnclaveConnectionProperties(); + } + this.innerProperties().withResourceCollection(resourceCollection); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@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.innerProperties); + 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.innerProperties + = EnclaveConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedEnclaveConnectionResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveConnectionResourceInner; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveEndpointProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveEndpointProperties.java new file mode 100644 index 000000000000..83fc49b93ba2 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveEndpointProperties.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.ProvisioningState; +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; + } + + /** + * Set the resourceCollection property: List of resource ids created by community endpoint. + * + * @param resourceCollection the resourceCollection value to set. + * @return the EnclaveEndpointProperties object itself. + */ + public EnclaveEndpointProperties withResourceCollection(List resourceCollection) { + this.resourceCollection = resourceCollection; + return this; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ruleCollection() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property ruleCollection in model EnclaveEndpointProperties")); + } else { + ruleCollection().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EnclaveEndpointProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ruleCollection", this.ruleCollection, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("resourceCollection", this.resourceCollection, + (writer, element) -> writer.writeString(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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveEndpointResourceInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveEndpointResourceInner.java new file mode 100644 index 000000000000..bc371c9c64ac --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveEndpointResourceInner.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * EnclaveEndpoint Model Resource. + */ +@Fluent +public final class EnclaveEndpointResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private EnclaveEndpointProperties innerProperties; + + /* + * 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 innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private EnclaveEndpointProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Get the ruleCollection property: Enclave Endpoint Rule Collection. + * + * @return the ruleCollection value. + */ + public List ruleCollection() { + return this.innerProperties() == null ? null : this.innerProperties().ruleCollection(); + } + + /** + * Set the ruleCollection property: Enclave Endpoint Rule Collection. + * + * @param ruleCollection the ruleCollection value to set. + * @return the EnclaveEndpointResourceInner object itself. + */ + public EnclaveEndpointResourceInner withRuleCollection(List ruleCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new EnclaveEndpointProperties(); + } + this.innerProperties().withRuleCollection(ruleCollection); + return this; + } + + /** + * Get the resourceCollection property: List of resource ids created by community endpoint. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.innerProperties() == null ? null : this.innerProperties().resourceCollection(); + } + + /** + * Set the resourceCollection property: List of resource ids created by community endpoint. + * + * @param resourceCollection the resourceCollection value to set. + * @return the EnclaveEndpointResourceInner object itself. + */ + public EnclaveEndpointResourceInner withResourceCollection(List resourceCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new EnclaveEndpointProperties(); + } + this.innerProperties().withResourceCollection(resourceCollection); + return this; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@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.innerProperties); + 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.innerProperties + = EnclaveEndpointProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedEnclaveEndpointResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveEndpointResourceInner; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveResourceInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveResourceInner.java new file mode 100644 index 000000000000..2a22d602b5ad --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/EnclaveResourceInner.java @@ -0,0 +1,447 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.models.EnclaveAddressSpaces; +import com.azure.resourcemanager.mission.models.EnclaveDefaultSettings; +import com.azure.resourcemanager.mission.models.EnclaveVirtualNetwork; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfiguration; +import com.azure.resourcemanager.mission.models.ManagedResourceGroupConfiguration; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentity; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Virtual Enclave Model Resource. + */ +@Fluent +public final class EnclaveResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private VirtualEnclaveProperties innerProperties; + + /* + * 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 innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private VirtualEnclaveProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the enclaveVirtualNetwork property: Virtual Network. + * + * @return the enclaveVirtualNetwork value. + */ + public EnclaveVirtualNetwork enclaveVirtualNetwork() { + return this.innerProperties() == null ? null : this.innerProperties().enclaveVirtualNetwork(); + } + + /** + * Set the enclaveVirtualNetwork property: Virtual Network. + * + * @param enclaveVirtualNetwork the enclaveVirtualNetwork value to set. + * @return the EnclaveResourceInner object itself. + */ + public EnclaveResourceInner withEnclaveVirtualNetwork(EnclaveVirtualNetwork enclaveVirtualNetwork) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualEnclaveProperties(); + } + this.innerProperties().withEnclaveVirtualNetwork(enclaveVirtualNetwork); + return this; + } + + /** + * Get the enclaveAddressSpaces property: Enclave Address Spaces. + * + * @return the enclaveAddressSpaces value. + */ + public EnclaveAddressSpaces enclaveAddressSpaces() { + return this.innerProperties() == null ? null : this.innerProperties().enclaveAddressSpaces(); + } + + /** + * Get the communityResourceId property: Community Resource Id. + * + * @return the communityResourceId value. + */ + public String communityResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().communityResourceId(); + } + + /** + * Set the communityResourceId property: Community Resource Id. + * + * @param communityResourceId the communityResourceId value to set. + * @return the EnclaveResourceInner object itself. + */ + public EnclaveResourceInner withCommunityResourceId(String communityResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualEnclaveProperties(); + } + this.innerProperties().withCommunityResourceId(communityResourceId); + return this; + } + + /** + * Get the enclaveDefaultSettings property: Default Settings. + * + * @return the enclaveDefaultSettings value. + */ + public EnclaveDefaultSettings enclaveDefaultSettings() { + return this.innerProperties() == null ? null : this.innerProperties().enclaveDefaultSettings(); + } + + /** + * Set the enclaveDefaultSettings property: Default Settings. + * + * @param enclaveDefaultSettings the enclaveDefaultSettings value to set. + * @return the EnclaveResourceInner object itself. + */ + public EnclaveResourceInner withEnclaveDefaultSettings(EnclaveDefaultSettings enclaveDefaultSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualEnclaveProperties(); + } + this.innerProperties().withEnclaveDefaultSettings(enclaveDefaultSettings); + return this; + } + + /** + * Get the resourceCollection property: List of resource ids created by Virtual Enclave. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.innerProperties() == null ? null : this.innerProperties().resourceCollection(); + } + + /** + * Set the resourceCollection property: List of resource ids created by Virtual Enclave. + * + * @param resourceCollection the resourceCollection value to set. + * @return the EnclaveResourceInner object itself. + */ + public EnclaveResourceInner withResourceCollection(List resourceCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualEnclaveProperties(); + } + this.innerProperties().withResourceCollection(resourceCollection); + return this; + } + + /** + * Get the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @return the managedResourceGroupConfiguration value. + */ + public ManagedResourceGroupConfiguration managedResourceGroupConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().managedResourceGroupConfiguration(); + } + + /** + * Set the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @param managedResourceGroupConfiguration the managedResourceGroupConfiguration value to set. + * @return the EnclaveResourceInner object itself. + */ + public EnclaveResourceInner + withManagedResourceGroupConfiguration(ManagedResourceGroupConfiguration managedResourceGroupConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualEnclaveProperties(); + } + this.innerProperties().withManagedResourceGroupConfiguration(managedResourceGroupConfiguration); + return this; + } + + /** + * Get the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @return the maintenanceModeConfiguration value. + */ + public MaintenanceModeConfiguration maintenanceModeConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().maintenanceModeConfiguration(); + } + + /** + * Set the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @param maintenanceModeConfiguration the maintenanceModeConfiguration value to set. + * @return the EnclaveResourceInner object itself. + */ + public EnclaveResourceInner + withMaintenanceModeConfiguration(MaintenanceModeConfiguration maintenanceModeConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualEnclaveProperties(); + } + this.innerProperties().withMaintenanceModeConfiguration(maintenanceModeConfiguration); + return this; + } + + /** + * Get the bastionEnabled property: Deploy Bastion service (True or False). + * + * @return the bastionEnabled value. + */ + public Boolean bastionEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().bastionEnabled(); + } + + /** + * Set the bastionEnabled property: Deploy Bastion service (True or False). + * + * @param bastionEnabled the bastionEnabled value to set. + * @return the EnclaveResourceInner object itself. + */ + public EnclaveResourceInner withBastionEnabled(Boolean bastionEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualEnclaveProperties(); + } + this.innerProperties().withBastionEnabled(bastionEnabled); + return this; + } + + /** + * Get the enclaveRoleAssignments property: Enclave role assignments. + * + * @return the enclaveRoleAssignments value. + */ + public List enclaveRoleAssignments() { + return this.innerProperties() == null ? null : this.innerProperties().enclaveRoleAssignments(); + } + + /** + * Set the enclaveRoleAssignments property: Enclave role assignments. + * + * @param enclaveRoleAssignments the enclaveRoleAssignments value to set. + * @return the EnclaveResourceInner object itself. + */ + public EnclaveResourceInner withEnclaveRoleAssignments(List enclaveRoleAssignments) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualEnclaveProperties(); + } + this.innerProperties().withEnclaveRoleAssignments(enclaveRoleAssignments); + return this; + } + + /** + * Get the workloadRoleAssignments property: Workload role assignments. + * + * @return the workloadRoleAssignments value. + */ + public List workloadRoleAssignments() { + return this.innerProperties() == null ? null : this.innerProperties().workloadRoleAssignments(); + } + + /** + * Set the workloadRoleAssignments property: Workload role assignments. + * + * @param workloadRoleAssignments the workloadRoleAssignments value to set. + * @return the EnclaveResourceInner object itself. + */ + public EnclaveResourceInner withWorkloadRoleAssignments(List workloadRoleAssignments) { + if (this.innerProperties() == null) { + this.innerProperties = new VirtualEnclaveProperties(); + } + this.innerProperties().withWorkloadRoleAssignments(workloadRoleAssignments); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@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.innerProperties); + 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.innerProperties = 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/InitiatorCallbackResponseInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/InitiatorCallbackResponseInner.java new file mode 100644 index 000000000000..db48b1a691fe --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/InitiatorCallbackResponseInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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. + */ +@Fluent +public final class InitiatorCallbackResponseInner implements JsonSerializable { + /* + * Confirmation message indicating the result of the operation. + */ + private String message; + + /** + * Creates an instance of InitiatorCallbackResponseInner class. + */ + public InitiatorCallbackResponseInner() { + } + + /** + * Get the message property: Confirmation message indicating the result of the operation. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Confirmation message indicating the result of the operation. + * + * @param message the message value to set. + * @return the InitiatorCallbackResponseInner object itself. + */ + public InitiatorCallbackResponseInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (message() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property message in model InitiatorCallbackResponseInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InitiatorCallbackResponseInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("message", this.message); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InitiatorCallbackResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InitiatorCallbackResponseInner 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 InitiatorCallbackResponseInner. + */ + public static InitiatorCallbackResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InitiatorCallbackResponseInner deserializedInitiatorCallbackResponseInner + = new InitiatorCallbackResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("message".equals(fieldName)) { + deserializedInitiatorCallbackResponseInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedInitiatorCallbackResponseInner; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/OperationInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/OperationInner.java new file mode 100644 index 000000000000..316b7ee31c4a --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.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 com.azure.resourcemanager.mission.models.ActionType; +import com.azure.resourcemanager.mission.models.OperationDisplay; +import com.azure.resourcemanager.mission.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +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 + * ARM/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; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public 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 ARM/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; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * 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: 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/TransitHubProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/TransitHubProperties.java new file mode 100644 index 000000000000..5aea7db04ada --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/TransitHubProperties.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.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 com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.TransitHubState; +import com.azure.resourcemanager.mission.models.TransitOption; +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; + } + + /** + * Set the resourceCollection property: List of resource ids modified by transitHubs. + * + * @param resourceCollection the resourceCollection value to set. + * @return the TransitHubProperties object itself. + */ + public TransitHubProperties withResourceCollection(List resourceCollection) { + this.resourceCollection = resourceCollection; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (transitOption() != null) { + transitOption().validate(); + } + } + + /** + * {@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); + jsonWriter.writeArrayField("resourceCollection", this.resourceCollection, + (writer, element) -> writer.writeString(element)); + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/TransitHubResourceInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/TransitHubResourceInner.java new file mode 100644 index 000000000000..f57dc64de004 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/TransitHubResourceInner.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.TransitHubState; +import com.azure.resourcemanager.mission.models.TransitOption; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * TransitHub Model Resource. + */ +@Fluent +public final class TransitHubResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private TransitHubProperties innerProperties; + + /* + * 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 innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private TransitHubProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the state property: The state of the transitHub. + * + * @return the state value. + */ + public TransitHubState state() { + return this.innerProperties() == null ? null : this.innerProperties().state(); + } + + /** + * Set the state property: The state of the transitHub. + * + * @param state the state value to set. + * @return the TransitHubResourceInner object itself. + */ + public TransitHubResourceInner withState(TransitHubState state) { + if (this.innerProperties() == null) { + this.innerProperties = new TransitHubProperties(); + } + this.innerProperties().withState(state); + return this; + } + + /** + * Get the transitOption property: The TransitOption of the transitHub. + * + * @return the transitOption value. + */ + public TransitOption transitOption() { + return this.innerProperties() == null ? null : this.innerProperties().transitOption(); + } + + /** + * Set the transitOption property: The TransitOption of the transitHub. + * + * @param transitOption the transitOption value to set. + * @return the TransitHubResourceInner object itself. + */ + public TransitHubResourceInner withTransitOption(TransitOption transitOption) { + if (this.innerProperties() == null) { + this.innerProperties = new TransitHubProperties(); + } + this.innerProperties().withTransitOption(transitOption); + return this; + } + + /** + * Get the resourceCollection property: List of resource ids modified by transitHubs. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.innerProperties() == null ? null : this.innerProperties().resourceCollection(); + } + + /** + * Set the resourceCollection property: List of resource ids modified by transitHubs. + * + * @param resourceCollection the resourceCollection value to set. + * @return the TransitHubResourceInner object itself. + */ + public TransitHubResourceInner withResourceCollection(List resourceCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new TransitHubProperties(); + } + this.innerProperties().withResourceCollection(resourceCollection); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@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.innerProperties); + 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.innerProperties = TransitHubProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedTransitHubResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTransitHubResourceInner; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/VirtualEnclaveProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/VirtualEnclaveProperties.java new file mode 100644 index 000000000000..5622f2bb112f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/VirtualEnclaveProperties.java @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.models.EnclaveAddressSpaces; +import com.azure.resourcemanager.mission.models.EnclaveDefaultSettings; +import com.azure.resourcemanager.mission.models.EnclaveVirtualNetwork; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfiguration; +import com.azure.resourcemanager.mission.models.ManagedResourceGroupConfiguration; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +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 EnclaveVirtualNetwork enclaveVirtualNetwork; + + /* + * Enclave Address Spaces + */ + private EnclaveAddressSpaces enclaveAddressSpaces; + + /* + * Community Resource Id. + */ + private String communityResourceId; + + /* + * Default Settings + */ + private EnclaveDefaultSettings enclaveDefaultSettings; + + /* + * List of resource ids created by Virtual Enclave. + */ + private List resourceCollection; + + /* + * Managed resource group configuration. + */ + private ManagedResourceGroupConfiguration managedResourceGroupConfiguration; + + /* + * Maintenance Mode configuration. + */ + private MaintenanceModeConfiguration maintenanceModeConfiguration; + + /* + * Deploy Bastion service (True or False). + */ + private Boolean bastionEnabled; + + /* + * Enclave role assignments + */ + private List enclaveRoleAssignments; + + /* + * Workload role assignments + */ + private List workloadRoleAssignments; + + /** + * 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 EnclaveVirtualNetwork 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(EnclaveVirtualNetwork enclaveVirtualNetwork) { + this.enclaveVirtualNetwork = enclaveVirtualNetwork; + return this; + } + + /** + * Get the enclaveAddressSpaces property: Enclave Address Spaces. + * + * @return the enclaveAddressSpaces value. + */ + public EnclaveAddressSpaces 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 enclaveDefaultSettings property: Default Settings. + * + * @return the enclaveDefaultSettings value. + */ + public EnclaveDefaultSettings enclaveDefaultSettings() { + return this.enclaveDefaultSettings; + } + + /** + * Set the enclaveDefaultSettings property: Default Settings. + * + * @param enclaveDefaultSettings the enclaveDefaultSettings value to set. + * @return the VirtualEnclaveProperties object itself. + */ + public VirtualEnclaveProperties withEnclaveDefaultSettings(EnclaveDefaultSettings enclaveDefaultSettings) { + this.enclaveDefaultSettings = enclaveDefaultSettings; + return this; + } + + /** + * Get the resourceCollection property: List of resource ids created by Virtual Enclave. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.resourceCollection; + } + + /** + * Set the resourceCollection property: List of resource ids created by Virtual Enclave. + * + * @param resourceCollection the resourceCollection value to set. + * @return the VirtualEnclaveProperties object itself. + */ + public VirtualEnclaveProperties withResourceCollection(List resourceCollection) { + this.resourceCollection = resourceCollection; + return this; + } + + /** + * Get the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @return the managedResourceGroupConfiguration value. + */ + public ManagedResourceGroupConfiguration managedResourceGroupConfiguration() { + return this.managedResourceGroupConfiguration; + } + + /** + * Set the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @param managedResourceGroupConfiguration the managedResourceGroupConfiguration value to set. + * @return the VirtualEnclaveProperties object itself. + */ + public VirtualEnclaveProperties + withManagedResourceGroupConfiguration(ManagedResourceGroupConfiguration managedResourceGroupConfiguration) { + this.managedResourceGroupConfiguration = managedResourceGroupConfiguration; + return this; + } + + /** + * Get the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @return the maintenanceModeConfiguration value. + */ + public MaintenanceModeConfiguration 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(MaintenanceModeConfiguration maintenanceModeConfiguration) { + this.maintenanceModeConfiguration = maintenanceModeConfiguration; + 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 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (enclaveVirtualNetwork() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property enclaveVirtualNetwork in model VirtualEnclaveProperties")); + } else { + enclaveVirtualNetwork().validate(); + } + if (enclaveAddressSpaces() != null) { + enclaveAddressSpaces().validate(); + } + if (communityResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property communityResourceId in model VirtualEnclaveProperties")); + } + if (enclaveDefaultSettings() != null) { + enclaveDefaultSettings().validate(); + } + if (managedResourceGroupConfiguration() != null) { + managedResourceGroupConfiguration().validate(); + } + if (maintenanceModeConfiguration() != null) { + maintenanceModeConfiguration().validate(); + } + if (enclaveRoleAssignments() != null) { + enclaveRoleAssignments().forEach(e -> e.validate()); + } + if (workloadRoleAssignments() != null) { + workloadRoleAssignments().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualEnclaveProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("enclaveVirtualNetwork", this.enclaveVirtualNetwork); + jsonWriter.writeStringField("communityResourceId", this.communityResourceId); + jsonWriter.writeJsonField("enclaveDefaultSettings", this.enclaveDefaultSettings); + jsonWriter.writeArrayField("resourceCollection", this.resourceCollection, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("managedResourceGroupConfiguration", this.managedResourceGroupConfiguration); + jsonWriter.writeJsonField("maintenanceModeConfiguration", this.maintenanceModeConfiguration); + 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)); + 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 = EnclaveVirtualNetwork.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 = EnclaveAddressSpaces.fromJson(reader); + } else if ("enclaveDefaultSettings".equals(fieldName)) { + deserializedVirtualEnclaveProperties.enclaveDefaultSettings + = EnclaveDefaultSettings.fromJson(reader); + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedVirtualEnclaveProperties.resourceCollection = resourceCollection; + } else if ("managedResourceGroupConfiguration".equals(fieldName)) { + deserializedVirtualEnclaveProperties.managedResourceGroupConfiguration + = ManagedResourceGroupConfiguration.fromJson(reader); + } else if ("maintenanceModeConfiguration".equals(fieldName)) { + deserializedVirtualEnclaveProperties.maintenanceModeConfiguration + = MaintenanceModeConfiguration.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 { + reader.skipChildren(); + } + } + + return deserializedVirtualEnclaveProperties; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/WorkloadProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/WorkloadProperties.java new file mode 100644 index 000000000000..e0fb72512bab --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/WorkloadProperties.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.fluent.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 com.azure.resourcemanager.mission.models.ProvisioningState; +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; + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@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 { + reader.skipChildren(); + } + } + + return deserializedWorkloadProperties; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/WorkloadResourceInner.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/WorkloadResourceInner.java new file mode 100644 index 000000000000..97197a4e99ea --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/WorkloadResourceInner.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.models.ProvisioningState; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Workload Model Resource. + */ +@Fluent +public final class WorkloadResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private WorkloadProperties innerProperties; + + /* + * 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 innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private WorkloadProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Get the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the resourceGroupCollection property: List of resource group ids. + * + * @return the resourceGroupCollection value. + */ + public List resourceGroupCollection() { + return this.innerProperties() == null ? null : this.innerProperties().resourceGroupCollection(); + } + + /** + * Set the resourceGroupCollection property: List of resource group ids. + * + * @param resourceGroupCollection the resourceGroupCollection value to set. + * @return the WorkloadResourceInner object itself. + */ + public WorkloadResourceInner withResourceGroupCollection(List resourceGroupCollection) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkloadProperties(); + } + this.innerProperties().withResourceGroupCollection(resourceGroupCollection); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@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.innerProperties); + 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.innerProperties = WorkloadProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedWorkloadResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadResourceInner; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/package-info.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/models/package-info.java new file mode 100644 index 000000000000..3e91077ab119 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/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) AutoRest Code Generator. + +/** + * Package containing the inner data models for MissionClient. + * Microsoft Mission Resource Provider management API. + */ +package com.azure.resourcemanager.mission.fluent.models; diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/package-info.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/fluent/package-info.java new file mode 100644 index 000000000000..0b7ebf5570cc --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/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) AutoRest Code Generator. + +/** + * Package containing the service clients for MissionClient. + * Microsoft Mission Resource Provider management API. + */ +package com.azure.resourcemanager.mission.fluent; diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalCallbackResponseImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalCallbackResponseImpl.java new file mode 100644 index 000000000000..019df175a60c --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalCallbackResponseImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.resourcemanager.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackResponse; + +public final class ApprovalCallbackResponseImpl implements ApprovalCallbackResponse { + private ApprovalCallbackResponseInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager serviceManager; + + ApprovalCallbackResponseImpl(ApprovalCallbackResponseInner innerObject, + com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String message() { + return this.innerModel().message(); + } + + public ApprovalCallbackResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mission.MissionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalDeletionCallbackResponseImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalDeletionCallbackResponseImpl.java new file mode 100644 index 000000000000..4f2e5fae0c71 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalDeletionCallbackResponseImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackResponse; + +public final class ApprovalDeletionCallbackResponseImpl implements ApprovalDeletionCallbackResponse { + private ApprovalDeletionCallbackResponseInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager serviceManager; + + ApprovalDeletionCallbackResponseImpl(ApprovalDeletionCallbackResponseInner innerObject, + com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String message() { + return this.innerModel().message(); + } + + public ApprovalDeletionCallbackResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mission.MissionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalResourceImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalResourceImpl.java new file mode 100644 index 000000000000..745055148bae --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalResourceImpl.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.ApprovalResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalPatchResource; +import com.azure.resourcemanager.mission.models.ApprovalResource; +import com.azure.resourcemanager.mission.models.Approver; +import com.azure.resourcemanager.mission.models.InitiatorCallbackRequest; +import com.azure.resourcemanager.mission.models.InitiatorCallbackResponse; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.RequestMetadata; +import com.azure.resourcemanager.mission.models.UpdateApprovalProperties; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ApprovalResourceImpl + implements ApprovalResource, ApprovalResource.Definition, ApprovalResource.Update { + private ApprovalResourceInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String parent1() { + return this.innerModel().parent1(); + } + + public String parent2() { + return this.innerModel().parent2(); + } + + public RequestMetadata requestMetadata() { + return this.innerModel().requestMetadata(); + } + + public List approvers() { + List inner = this.innerModel().approvers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String ticketId() { + return this.innerModel().ticketId(); + } + + public OffsetDateTime createdAt() { + return this.innerModel().createdAt(); + } + + public OffsetDateTime stateChangedAt() { + return this.innerModel().stateChangedAt(); + } + + public ApprovalResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mission.MissionManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String approvalName; + + private ApprovalPatchResource 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.mission.MissionManager serviceManager) { + this.innerObject = new ApprovalResourceInner(); + this.serviceManager = serviceManager; + this.approvalName = name; + } + + public ApprovalResourceImpl update() { + this.updateProperties = new ApprovalPatchResource(); + 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.mission.MissionManager 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 InitiatorCallbackResponse initiatorCallback(InitiatorCallbackRequest body) { + return serviceManager.approvals().initiatorCallback(resourceUri, approvalName, body); + } + + public InitiatorCallbackResponse initiatorCallback(InitiatorCallbackRequest body, Context context) { + return serviceManager.approvals().initiatorCallback(resourceUri, approvalName, body, context); + } + + public ApprovalResourceImpl withParent1(String parent1) { + this.innerModel().withParent1(parent1); + return this; + } + + public ApprovalResourceImpl withParent2(String parent2) { + this.innerModel().withParent2(parent2); + return this; + } + + public ApprovalResourceImpl withRequestMetadata(RequestMetadata requestMetadata) { + this.innerModel().withRequestMetadata(requestMetadata); + return this; + } + + public ApprovalResourceImpl withApprovers(List approvers) { + this.innerModel().withApprovers(approvers); + return this; + } + + public ApprovalResourceImpl withTicketId(String ticketId) { + this.innerModel().withTicketId(ticketId); + return this; + } + + public ApprovalResourceImpl withCreatedAt(OffsetDateTime createdAt) { + this.innerModel().withCreatedAt(createdAt); + return this; + } + + public ApprovalResourceImpl withStateChangedAt(OffsetDateTime stateChangedAt) { + this.innerModel().withStateChangedAt(stateChangedAt); + return this; + } + + public ApprovalResourceImpl withProperties(UpdateApprovalProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalsClientImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalsClientImpl.java new file mode 100644 index 000000000000..8f4665793a83 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalsClientImpl.java @@ -0,0 +1,1277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.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.mission.fluent.ApprovalsClient; +import com.azure.resourcemanager.mission.fluent.models.ApprovalResourceInner; +import com.azure.resourcemanager.mission.fluent.models.InitiatorCallbackResponseInner; +import com.azure.resourcemanager.mission.models.ApprovalPatchResource; +import com.azure.resourcemanager.mission.models.ApprovalResourceListResult; +import com.azure.resourcemanager.mission.models.InitiatorCallbackRequest; +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 MissionClientImpl client; + + /** + * Initializes an instance of ApprovalsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApprovalsClientImpl(MissionClientImpl client) { + this.service + = RestProxy.create(ApprovalsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MissionClientApprovals to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MissionClientApprova") + public interface ApprovalsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.Mission/approvals") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByParent(@HostParam("$host") 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/{approvalName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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" }) + @Put("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, + @BodyParam("application/json") ApprovalResourceInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, + @BodyParam("application/json") ApprovalPatchResource properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") 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" }) + @Post("/{resourceUri}/providers/Microsoft.Mission/approvals/{approvalName}/initiatorCallback") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> initiatorCallback(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("approvalName") String approvalName, + @BodyParam("application/json") InitiatorCallbackRequest body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByParentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentSinglePageAsync(String resourceUri, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByParentAsync(String resourceUri, Context context) { + return new PagedFlux<>(() -> listByParentSinglePageAsync(resourceUri, context), + nextLink -> listByParentNextSinglePageAsync(nextLink, 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 ManagementException thrown 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<>(listByParentAsync(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 ManagementException thrown 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<>(listByParentAsync(resourceUri, 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (approvalName == null) { + return Mono.error(new IllegalArgumentException("Parameter approvalName is required and cannot be null.")); + } + 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String approvalName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (approvalName == null) { + return Mono.error(new IllegalArgumentException("Parameter approvalName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(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 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) { + return getWithResponseAsync(resourceUri, approvalName, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (approvalName == null) { + return Mono.error(new IllegalArgumentException("Parameter approvalName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, approvalName, resource, accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, String approvalName, + ApprovalResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (approvalName == null) { + return Mono.error(new IllegalArgumentException("Parameter approvalName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, approvalName, + resource, accept, 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. + * @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 PollerFlux} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalResourceInner> beginCreateOrUpdateAsync( + String resourceUri, String approvalName, ApprovalResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceUri, approvalName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 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) { + return this.beginCreateOrUpdateAsync(resourceUri, approvalName, resource).getSyncPoller(); + } + + /** + * 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) { + return this.beginCreateOrUpdateAsync(resourceUri, approvalName, resource, context).getSyncPoller(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, String approvalName, + ApprovalResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceUri, approvalName, resource, context).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 createOrUpdateAsync(resourceUri, approvalName, resource).block(); + } + + /** + * 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 createOrUpdateAsync(resourceUri, approvalName, resource, context).block(); + } + + /** + * 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, + ApprovalPatchResource properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (approvalName == null) { + return Mono.error(new IllegalArgumentException("Parameter approvalName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + approvalName, properties, accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceUri, String approvalName, + ApprovalPatchResource properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (approvalName == null) { + return Mono.error(new IllegalArgumentException("Parameter approvalName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, approvalName, + properties, accept, 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, ApprovalPatchResource 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. + * @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 PollerFlux} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalResourceInner> beginUpdateAsync(String resourceUri, + String approvalName, ApprovalPatchResource properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceUri, approvalName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 the {@link SyncPoller} for polling of approval Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalResourceInner> beginUpdate(String resourceUri, + String approvalName, ApprovalPatchResource properties) { + return this.beginUpdateAsync(resourceUri, approvalName, properties).getSyncPoller(); + } + + /** + * 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, ApprovalPatchResource properties, Context context) { + return this.beginUpdateAsync(resourceUri, approvalName, properties, context).getSyncPoller(); + } + + /** + * 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, + ApprovalPatchResource 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceUri, String approvalName, + ApprovalPatchResource properties, Context context) { + return beginUpdateAsync(resourceUri, approvalName, properties, context).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, ApprovalPatchResource properties) { + return updateAsync(resourceUri, approvalName, properties).block(); + } + + /** + * 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, ApprovalPatchResource properties, + Context context) { + return updateAsync(resourceUri, approvalName, properties, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (approvalName == null) { + return Mono.error(new IllegalArgumentException("Parameter approvalName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + approvalName, accept, 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. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceUri, String approvalName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (approvalName == null) { + return Mono.error(new IllegalArgumentException("Parameter approvalName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, approvalName, accept, + 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. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceUri, String approvalName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceUri, approvalName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri, String approvalName) { + return this.beginDeleteAsync(resourceUri, approvalName).getSyncPoller(); + } + + /** + * 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) { + return this.beginDeleteAsync(resourceUri, approvalName, context).getSyncPoller(); + } + + /** + * 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. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceUri, String approvalName, Context context) { + return beginDeleteAsync(resourceUri, approvalName, context).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) { + deleteAsync(resourceUri, approvalName).block(); + } + + /** + * 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) { + deleteAsync(resourceUri, approvalName, context).block(); + } + + /** + * 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 response body after handling of approvalCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> initiatorCallbackWithResponseAsync(String resourceUri, String approvalName, + InitiatorCallbackRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (approvalName == null) { + return Mono.error(new IllegalArgumentException("Parameter approvalName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.initiatorCallback(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, approvalName, body, accept, 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. + * @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 body after handling of approvalCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> initiatorCallbackWithResponseAsync(String resourceUri, String approvalName, + InitiatorCallbackRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (approvalName == null) { + return Mono.error(new IllegalArgumentException("Parameter approvalName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.initiatorCallback(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + approvalName, body, accept, 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InitiatorCallbackResponseInner> + beginInitiatorCallbackAsync(String resourceUri, String approvalName, InitiatorCallbackRequest body) { + Mono>> mono = initiatorCallbackWithResponseAsync(resourceUri, approvalName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), InitiatorCallbackResponseInner.class, InitiatorCallbackResponseInner.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. + * @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 PollerFlux} for polling of response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, InitiatorCallbackResponseInner> + beginInitiatorCallbackAsync(String resourceUri, String approvalName, InitiatorCallbackRequest body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = initiatorCallbackWithResponseAsync(resourceUri, approvalName, body, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), InitiatorCallbackResponseInner.class, InitiatorCallbackResponseInner.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 {@link SyncPoller} for polling of response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InitiatorCallbackResponseInner> + beginInitiatorCallback(String resourceUri, String approvalName, InitiatorCallbackRequest body) { + return this.beginInitiatorCallbackAsync(resourceUri, approvalName, body).getSyncPoller(); + } + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, InitiatorCallbackResponseInner> + beginInitiatorCallback(String resourceUri, String approvalName, InitiatorCallbackRequest body, + Context context) { + return this.beginInitiatorCallbackAsync(resourceUri, approvalName, body, context).getSyncPoller(); + } + + /** + * 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 response body after handling of approvalCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono initiatorCallbackAsync(String resourceUri, String approvalName, + InitiatorCallbackRequest body) { + return beginInitiatorCallbackAsync(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. + * @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 body after handling of approvalCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono initiatorCallbackAsync(String resourceUri, String approvalName, + InitiatorCallbackRequest body, Context context) { + return beginInitiatorCallbackAsync(resourceUri, approvalName, body, context).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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InitiatorCallbackResponseInner initiatorCallback(String resourceUri, String approvalName, + InitiatorCallbackRequest body) { + return initiatorCallbackAsync(resourceUri, approvalName, body).block(); + } + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InitiatorCallbackResponseInner initiatorCallback(String resourceUri, String approvalName, + InitiatorCallbackRequest body, Context context) { + return initiatorCallbackAsync(resourceUri, approvalName, body, context).block(); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalsImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalsImpl.java new file mode 100644 index 000000000000..f15dfb40f49a --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ApprovalsImpl.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.ApprovalsClient; +import com.azure.resourcemanager.mission.fluent.models.ApprovalResourceInner; +import com.azure.resourcemanager.mission.fluent.models.InitiatorCallbackResponseInner; +import com.azure.resourcemanager.mission.models.ApprovalResource; +import com.azure.resourcemanager.mission.models.Approvals; +import com.azure.resourcemanager.mission.models.InitiatorCallbackRequest; +import com.azure.resourcemanager.mission.models.InitiatorCallbackResponse; + +public final class ApprovalsImpl implements Approvals { + private static final ClientLogger LOGGER = new ClientLogger(ApprovalsImpl.class); + + private final ApprovalsClient innerClient; + + private final com.azure.resourcemanager.mission.MissionManager serviceManager; + + public ApprovalsImpl(ApprovalsClient innerClient, com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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 InitiatorCallbackResponse initiatorCallback(String resourceUri, String approvalName, + InitiatorCallbackRequest body) { + InitiatorCallbackResponseInner inner = this.serviceClient().initiatorCallback(resourceUri, approvalName, body); + if (inner != null) { + return new InitiatorCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public InitiatorCallbackResponse initiatorCallback(String resourceUri, String approvalName, + InitiatorCallbackRequest body, Context context) { + InitiatorCallbackResponseInner inner + = this.serviceClient().initiatorCallback(resourceUri, approvalName, body, context); + if (inner != null) { + return new InitiatorCallbackResponseImpl(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.mission.MissionManager manager() { + return this.serviceManager; + } + + public ApprovalResourceImpl define(String name) { + return new ApprovalResourceImpl(name, this.manager()); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CheckAddressSpaceAvailabilityResponseImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CheckAddressSpaceAvailabilityResponseImpl.java new file mode 100644 index 000000000000..bff0e9dea939 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CheckAddressSpaceAvailabilityResponseImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.resourcemanager.mission.fluent.models.CheckAddressSpaceAvailabilityResponseInner; +import com.azure.resourcemanager.mission.models.CheckAddressSpaceAvailabilityResponse; + +public final class CheckAddressSpaceAvailabilityResponseImpl implements CheckAddressSpaceAvailabilityResponse { + private CheckAddressSpaceAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager serviceManager; + + CheckAddressSpaceAvailabilityResponseImpl(CheckAddressSpaceAvailabilityResponseInner innerObject, + com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public boolean value() { + return this.innerModel().value(); + } + + public CheckAddressSpaceAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mission.MissionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunitiesClientImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunitiesClientImpl.java new file mode 100644 index 000000000000..f79a3ccc9939 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunitiesClientImpl.java @@ -0,0 +1,1437 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.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.mission.fluent.CommunitiesClient; +import com.azure.resourcemanager.mission.fluent.models.CheckAddressSpaceAvailabilityResponseInner; +import com.azure.resourcemanager.mission.fluent.models.CommunityResourceInner; +import com.azure.resourcemanager.mission.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.mission.models.CommunityPatchResource; +import com.azure.resourcemanager.mission.models.CommunityResourceListResult; +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 MissionClientImpl client; + + /** + * Initializes an instance of CommunitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CommunitiesClientImpl(MissionClientImpl client) { + this.service + = RestProxy.create(CommunitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MissionClientCommunities to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MissionClientCommuni") + public interface CommunitiesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/communities") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") 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/{communityName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") 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" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @BodyParam("application/json") CommunityResourceInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @BodyParam("application/json") CommunityPatchResource properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") 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" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/checkAddressSpaceAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkAddressSpaceAvailability( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @BodyParam("application/json") CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest, + @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("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context 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() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + 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. + * + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * 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<>(listAsync(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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, 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 ManagementException thrown 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<>(listByResourceGroupAsync(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 ManagementException thrown 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<>(listByResourceGroupAsync(resourceGroupName, 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String communityName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(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 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) { + return getByResourceGroupWithResponseAsync(resourceGroupName, communityName, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, resource, accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String communityName, CommunityResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, resource, accept, 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. + * @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 PollerFlux} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunityResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String communityName, CommunityResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, communityName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, communityName, resource).getSyncPoller(); + } + + /** + * 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, communityName, resource, context).getSyncPoller(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String communityName, + CommunityResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, communityName, resource, context).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 createOrUpdateAsync(resourceGroupName, communityName, resource).block(); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, communityName, resource, context).block(); + } + + /** + * 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, + CommunityPatchResource properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, properties, accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String communityName, + CommunityPatchResource properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communityName, properties, accept, 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, CommunityPatchResource 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. + * @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 PollerFlux} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunityResourceInner> beginUpdateAsync( + String resourceGroupName, String communityName, CommunityPatchResource properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, communityName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 the {@link SyncPoller} for polling of community Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CommunityResourceInner> beginUpdate(String resourceGroupName, + String communityName, CommunityPatchResource properties) { + return this.beginUpdateAsync(resourceGroupName, communityName, properties).getSyncPoller(); + } + + /** + * 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, CommunityPatchResource properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, communityName, properties, context).getSyncPoller(); + } + + /** + * 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, + CommunityPatchResource 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String communityName, + CommunityPatchResource properties, Context context) { + return beginUpdateAsync(resourceGroupName, communityName, properties, context).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, + CommunityPatchResource properties) { + return updateAsync(resourceGroupName, communityName, properties).block(); + } + + /** + * 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, + CommunityPatchResource properties, Context context) { + return updateAsync(resourceGroupName, communityName, properties, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, accept, 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. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String communityName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communityName, accept, 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. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String communityName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, communityName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String communityName) { + return this.beginDeleteAsync(resourceGroupName, communityName).getSyncPoller(); + } + + /** + * 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) { + return this.beginDeleteAsync(resourceGroupName, communityName, context).getSyncPoller(); + } + + /** + * 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. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communityName, Context context) { + return beginDeleteAsync(resourceGroupName, communityName, context).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) { + deleteAsync(resourceGroupName, communityName).block(); + } + + /** + * 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) { + deleteAsync(resourceGroupName, communityName, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (checkAddressSpaceAvailabilityRequest == null) { + return Mono.error(new IllegalArgumentException( + "Parameter checkAddressSpaceAvailabilityRequest is required and cannot be null.")); + } else { + checkAddressSpaceAvailabilityRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkAddressSpaceAvailability(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, communityName, + checkAddressSpaceAvailabilityRequest, accept, 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkAddressSpaceAvailabilityWithResponseAsync( + String resourceGroupName, String communityName, + CheckAddressSpaceAvailabilityRequest checkAddressSpaceAvailabilityRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (checkAddressSpaceAvailabilityRequest == null) { + return Mono.error(new IllegalArgumentException( + "Parameter checkAddressSpaceAvailabilityRequest is required and cannot be null.")); + } else { + checkAddressSpaceAvailabilityRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.checkAddressSpaceAvailability(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, checkAddressSpaceAvailabilityRequest, + accept, 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 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) { + return checkAddressSpaceAvailabilityWithResponseAsync(resourceGroupName, communityName, + checkAddressSpaceAvailabilityRequest, context).block(); + } + + /** + * 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> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunitiesImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunitiesImpl.java new file mode 100644 index 000000000000..580b91cc88de --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunitiesImpl.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.CommunitiesClient; +import com.azure.resourcemanager.mission.fluent.models.CheckAddressSpaceAvailabilityResponseInner; +import com.azure.resourcemanager.mission.fluent.models.CommunityResourceInner; +import com.azure.resourcemanager.mission.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.mission.models.CheckAddressSpaceAvailabilityResponse; +import com.azure.resourcemanager.mission.models.Communities; +import com.azure.resourcemanager.mission.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.mission.MissionManager serviceManager; + + public CommunitiesImpl(CommunitiesClient innerClient, + com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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 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.mission.MissionManager manager() { + return this.serviceManager; + } + + public CommunityResourceImpl define(String name) { + return new CommunityResourceImpl(name, this.manager()); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityEndpointResourceImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityEndpointResourceImpl.java new file mode 100644 index 000000000000..f20c1490f7e6 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityEndpointResourceImpl.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.CommunityEndpointResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackResponse; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackResponse; +import com.azure.resourcemanager.mission.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.CommunityEndpointPatchResource; +import com.azure.resourcemanager.mission.models.CommunityEndpointResource; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.UpdateCommunityEndpointPatchProperties; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class CommunityEndpointResourceImpl + implements CommunityEndpointResource, CommunityEndpointResource.Definition, CommunityEndpointResource.Update { + private CommunityEndpointResourceInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public List ruleCollection() { + List inner = this.innerModel().ruleCollection(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List resourceCollection() { + List inner = this.innerModel().resourceCollection(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + 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.mission.MissionManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String communityName; + + private String communityEndpointName; + + private CommunityEndpointPatchResource 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.mission.MissionManager serviceManager) { + this.innerObject = new CommunityEndpointResourceInner(); + this.serviceManager = serviceManager; + this.communityEndpointName = name; + } + + public CommunityEndpointResourceImpl update() { + this.updateProperties = new CommunityEndpointPatchResource(); + 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.mission.MissionManager 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 ApprovalCallbackResponse approvalCallback(ApprovalCallbackRequest body) { + return serviceManager.communityEndpoints() + .approvalCallback(resourceGroupName, communityName, communityEndpointName, body); + } + + public ApprovalCallbackResponse approvalCallback(ApprovalCallbackRequest body, Context context) { + return serviceManager.communityEndpoints() + .approvalCallback(resourceGroupName, communityName, communityEndpointName, body, context); + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body) { + return serviceManager.communityEndpoints() + .approvalDeletionCallback(resourceGroupName, communityName, communityEndpointName, body); + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body, + Context context) { + return serviceManager.communityEndpoints() + .approvalDeletionCallback(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 withRuleCollection(List ruleCollection) { + this.innerModel().withRuleCollection(ruleCollection); + return this; + } + + public CommunityEndpointResourceImpl withResourceCollection(List resourceCollection) { + this.innerModel().withResourceCollection(resourceCollection); + return this; + } + + public CommunityEndpointResourceImpl withProperties(UpdateCommunityEndpointPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityEndpointsClientImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityEndpointsClientImpl.java new file mode 100644 index 000000000000..39792121aa61 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityEndpointsClientImpl.java @@ -0,0 +1,1963 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.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.mission.fluent.CommunityEndpointsClient; +import com.azure.resourcemanager.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.CommunityEndpointResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.CommunityEndpointPatchResource; +import com.azure.resourcemanager.mission.models.CommunityEndpointResourceListResult; +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 MissionClientImpl client; + + /** + * Initializes an instance of CommunityEndpointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CommunityEndpointsClientImpl(MissionClientImpl client) { + this.service = RestProxy.create(CommunityEndpointsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MissionClientCommunityEndpoints to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MissionClientCommuni") + public interface CommunityEndpointsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("$host") 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCommunityResource(@HostParam("$host") 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/{communityEndpointName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @BodyParam("application/json") CommunityEndpointResourceInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @BodyParam("application/json") CommunityEndpointPatchResource properties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "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("$host") 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" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}/approvalCallback") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> approvalCallback(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @BodyParam("application/json") ApprovalCallbackRequest body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/communityEndpoints/{communityEndpointName}/approvalDeletionCallback") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> approvalDeletionCallback(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("communityEndpointName") String communityEndpointName, + @BodyParam("application/json") ApprovalDeletionCallbackRequest body, @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("$host") String endpoint, + @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("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(String communityName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String communityName, Context context) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(communityName, context), + nextLink -> listBySubscriptionNextSinglePageAsync(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 as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String communityName) { + return new PagedIterable<>(listBySubscriptionAsync(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 ManagementException thrown 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<>(listBySubscriptionAsync(communityName, 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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCommunityResourceSinglePageAsync(String resourceGroupName, String communityName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCommunityResourceAsync(String resourceGroupName, + String communityName, Context context) { + return new PagedFlux<>(() -> listByCommunityResourceSinglePageAsync(resourceGroupName, communityName, context), + nextLink -> listByCommunityResourceNextSinglePageAsync(nextLink, 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 ManagementException thrown 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<>(listByCommunityResourceAsync(resourceGroupName, 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 ManagementException thrown 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<>(listByCommunityResourceAsync(resourceGroupName, communityName, 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String communityName, String communityEndpointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(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 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) { + return getWithResponseAsync(resourceGroupName, communityName, communityEndpointName, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, resource, + accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String communityName, String communityEndpointName, CommunityEndpointResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, resource, accept, + 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. + * @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 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, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, communityName, + communityEndpointName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, communityName, communityEndpointName, resource) + .getSyncPoller(); + } + + /** + * 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, communityName, communityEndpointName, resource, context) + .getSyncPoller(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, communityName, communityEndpointName, resource, context) + .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 createOrUpdateAsync(resourceGroupName, communityName, communityEndpointName, resource).block(); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, communityName, communityEndpointName, resource, context).block(); + } + + /** + * 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, CommunityEndpointPatchResource properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, properties, + accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointPatchResource properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communityName, communityEndpointName, properties, accept, 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, + CommunityEndpointPatchResource 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. + * @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 PollerFlux} for polling of communityEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CommunityEndpointResourceInner> beginUpdateAsync( + String resourceGroupName, String communityName, String communityEndpointName, + CommunityEndpointPatchResource properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, communityName, communityEndpointName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 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, + CommunityEndpointPatchResource properties) { + return this.beginUpdateAsync(resourceGroupName, communityName, communityEndpointName, properties) + .getSyncPoller(); + } + + /** + * 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, + CommunityEndpointPatchResource properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, communityName, communityEndpointName, properties, context) + .getSyncPoller(); + } + + /** + * 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, CommunityEndpointPatchResource 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String communityName, + String communityEndpointName, CommunityEndpointPatchResource properties, Context context) { + return beginUpdateAsync(resourceGroupName, communityName, communityEndpointName, properties, context).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, CommunityEndpointPatchResource properties) { + return updateAsync(resourceGroupName, communityName, communityEndpointName, properties).block(); + } + + /** + * 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, CommunityEndpointPatchResource properties, Context context) { + return updateAsync(resourceGroupName, communityName, communityEndpointName, properties, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, accept, 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. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String communityName, + String communityEndpointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communityName, communityEndpointName, accept, 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. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String communityName, + String communityEndpointName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, communityName, communityEndpointName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), 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 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) { + return this.beginDeleteAsync(resourceGroupName, communityName, communityEndpointName).getSyncPoller(); + } + + /** + * 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) { + return this.beginDeleteAsync(resourceGroupName, communityName, communityEndpointName, context).getSyncPoller(); + } + + /** + * 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. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communityName, String communityEndpointName, + Context context) { + return beginDeleteAsync(resourceGroupName, communityName, communityEndpointName, context).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) { + deleteAsync(resourceGroupName, communityName, communityEndpointName).block(); + } + + /** + * 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) { + deleteAsync(resourceGroupName, communityName, communityEndpointName, context).block(); + } + + /** + * 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 response body after handling of approvalCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalCallbackWithResponseAsync(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalCallbackRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.approvalCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, body, accept, + 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. + * @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 body after handling of approvalCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalCallbackWithResponseAsync(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalCallbackRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.approvalCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, body, accept, + 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalCallbackResponseInner> + beginApprovalCallbackAsync(String resourceGroupName, String communityName, String communityEndpointName, + ApprovalCallbackRequest body) { + Mono>> mono + = approvalCallbackWithResponseAsync(resourceGroupName, communityName, communityEndpointName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalCallbackResponseInner.class, ApprovalCallbackResponseInner.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. + * @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 PollerFlux} for polling of response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalCallbackResponseInner> + beginApprovalCallbackAsync(String resourceGroupName, String communityName, String communityEndpointName, + ApprovalCallbackRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = approvalCallbackWithResponseAsync(resourceGroupName, communityName, communityEndpointName, body, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalCallbackResponseInner.class, ApprovalCallbackResponseInner.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 {@link SyncPoller} for polling of response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + String resourceGroupName, String communityName, String communityEndpointName, ApprovalCallbackRequest body) { + return this.beginApprovalCallbackAsync(resourceGroupName, communityName, communityEndpointName, body) + .getSyncPoller(); + } + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + String resourceGroupName, String communityName, String communityEndpointName, ApprovalCallbackRequest body, + Context context) { + return this.beginApprovalCallbackAsync(resourceGroupName, communityName, communityEndpointName, body, context) + .getSyncPoller(); + } + + /** + * 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 response body after handling of approvalCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalCallbackAsync(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body) { + return beginApprovalCallbackAsync(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. + * @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 body after handling of approvalCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalCallbackAsync(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body, Context context) { + return beginApprovalCallbackAsync(resourceGroupName, communityName, communityEndpointName, body, context).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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalCallbackResponseInner approvalCallback(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body) { + return approvalCallbackAsync(resourceGroupName, communityName, communityEndpointName, body).block(); + } + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalCallbackResponseInner approvalCallback(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body, Context context) { + return approvalCallbackAsync(resourceGroupName, communityName, communityEndpointName, body, context).block(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalDeletionCallbackWithResponseAsync(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalDeletionCallbackRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.approvalDeletionCallback(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, communityName, + communityEndpointName, body, accept, 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. + * @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 body after handling of approvalDeletionCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalDeletionCallbackWithResponseAsync(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (communityEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter communityEndpointName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.approvalDeletionCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, communityEndpointName, body, accept, + 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallbackAsync(String resourceGroupName, String communityName, String communityEndpointName, + ApprovalDeletionCallbackRequest body) { + Mono>> mono + = approvalDeletionCallbackWithResponseAsync(resourceGroupName, communityName, communityEndpointName, body); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), ApprovalDeletionCallbackResponseInner.class, + ApprovalDeletionCallbackResponseInner.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. + * @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 PollerFlux} for polling of response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallbackAsync(String resourceGroupName, String communityName, String communityEndpointName, + ApprovalDeletionCallbackRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = approvalDeletionCallbackWithResponseAsync(resourceGroupName, + communityName, communityEndpointName, body, context); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), ApprovalDeletionCallbackResponseInner.class, + ApprovalDeletionCallbackResponseInner.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 {@link SyncPoller} for polling of response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(String resourceGroupName, String communityName, String communityEndpointName, + ApprovalDeletionCallbackRequest body) { + return this.beginApprovalDeletionCallbackAsync(resourceGroupName, communityName, communityEndpointName, body) + .getSyncPoller(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(String resourceGroupName, String communityName, String communityEndpointName, + ApprovalDeletionCallbackRequest body, Context context) { + return this + .beginApprovalDeletionCallbackAsync(resourceGroupName, communityName, communityEndpointName, body, context) + .getSyncPoller(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalDeletionCallbackAsync(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalDeletionCallbackRequest body) { + return beginApprovalDeletionCallbackAsync(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. + * @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 body after handling of approvalDeletionCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalDeletionCallbackAsync(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + return beginApprovalDeletionCallbackAsync(resourceGroupName, communityName, communityEndpointName, body, + context).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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalDeletionCallbackRequest body) { + return approvalDeletionCallbackAsync(resourceGroupName, communityName, communityEndpointName, body).block(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, + String communityName, String communityEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + return approvalDeletionCallbackAsync(resourceGroupName, communityName, communityEndpointName, body, context) + .block(); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCommunityResourceNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityEndpointsImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityEndpointsImpl.java new file mode 100644 index 000000000000..aa3040fa3911 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityEndpointsImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.CommunityEndpointsClient; +import com.azure.resourcemanager.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.CommunityEndpointResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackResponse; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackResponse; +import com.azure.resourcemanager.mission.models.CommunityEndpointResource; +import com.azure.resourcemanager.mission.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.mission.MissionManager serviceManager; + + public CommunityEndpointsImpl(CommunityEndpointsClient innerClient, + com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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 ApprovalCallbackResponse approvalCallback(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body) { + ApprovalCallbackResponseInner inner + = this.serviceClient().approvalCallback(resourceGroupName, communityName, communityEndpointName, body); + if (inner != null) { + return new ApprovalCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalCallbackResponse approvalCallback(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalCallbackRequest body, Context context) { + ApprovalCallbackResponseInner inner = this.serviceClient() + .approvalCallback(resourceGroupName, communityName, communityEndpointName, body, context); + if (inner != null) { + return new ApprovalCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body) { + ApprovalDeletionCallbackResponseInner inner = this.serviceClient() + .approvalDeletionCallback(resourceGroupName, communityName, communityEndpointName, body); + if (inner != null) { + return new ApprovalDeletionCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(String resourceGroupName, String communityName, + String communityEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + ApprovalDeletionCallbackResponseInner inner = this.serviceClient() + .approvalDeletionCallback(resourceGroupName, communityName, communityEndpointName, body, context); + if (inner != null) { + return new ApprovalDeletionCallbackResponseImpl(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.mission.MissionManager manager() { + return this.serviceManager; + } + + public CommunityEndpointResourceImpl define(String name) { + return new CommunityEndpointResourceImpl(name, this.manager()); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityResourceImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityResourceImpl.java new file mode 100644 index 000000000000..f68594efe54d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/CommunityResourceImpl.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.models.CommunityResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalSettings; +import com.azure.resourcemanager.mission.models.AzureResourceManagerCommonTypesManagedServiceIdentityUpdate; +import com.azure.resourcemanager.mission.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.mission.models.CheckAddressSpaceAvailabilityResponse; +import com.azure.resourcemanager.mission.models.CommunityPatchResource; +import com.azure.resourcemanager.mission.models.CommunityResource; +import com.azure.resourcemanager.mission.models.GovernedServiceItem; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfiguration; +import com.azure.resourcemanager.mission.models.ManagedResourceGroupConfiguration; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentity; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import com.azure.resourcemanager.mission.models.UpdateCommunityPatchProperties; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class CommunityResourceImpl + implements CommunityResource, CommunityResource.Definition, CommunityResource.Update { + private CommunityResourceInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager 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 ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String addressSpace() { + return this.innerModel().addressSpace(); + } + + public List dnsServers() { + List inner = this.innerModel().dnsServers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List resourceCollection() { + List inner = this.innerModel().resourceCollection(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ManagedResourceGroupConfiguration managedResourceGroupConfiguration() { + return this.innerModel().managedResourceGroupConfiguration(); + } + + public List governedServiceList() { + List inner = this.innerModel().governedServiceList(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List communityRoleAssignments() { + List inner = this.innerModel().communityRoleAssignments(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ApprovalSettings approvalSettings() { + return this.innerModel().approvalSettings(); + } + + public MaintenanceModeConfiguration maintenanceModeConfiguration() { + return this.innerModel().maintenanceModeConfiguration(); + } + + 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.mission.MissionManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String communityName; + + private CommunityPatchResource 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.mission.MissionManager serviceManager) { + this.innerObject = new CommunityResourceInner(); + this.serviceManager = serviceManager; + this.communityName = name; + } + + public CommunityResourceImpl update() { + this.updateProperties = new CommunityPatchResource(); + 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.mission.MissionManager 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 withIdentity(ManagedServiceIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public CommunityResourceImpl withAddressSpace(String addressSpace) { + this.innerModel().withAddressSpace(addressSpace); + return this; + } + + public CommunityResourceImpl withDnsServers(List dnsServers) { + this.innerModel().withDnsServers(dnsServers); + return this; + } + + public CommunityResourceImpl + withManagedResourceGroupConfiguration(ManagedResourceGroupConfiguration managedResourceGroupConfiguration) { + this.innerModel().withManagedResourceGroupConfiguration(managedResourceGroupConfiguration); + return this; + } + + public CommunityResourceImpl withGovernedServiceList(List governedServiceList) { + this.innerModel().withGovernedServiceList(governedServiceList); + return this; + } + + public CommunityResourceImpl withCommunityRoleAssignments(List communityRoleAssignments) { + this.innerModel().withCommunityRoleAssignments(communityRoleAssignments); + return this; + } + + public CommunityResourceImpl withApprovalSettings(ApprovalSettings approvalSettings) { + this.innerModel().withApprovalSettings(approvalSettings); + return this; + } + + public CommunityResourceImpl + withMaintenanceModeConfiguration(MaintenanceModeConfiguration maintenanceModeConfiguration) { + this.innerModel().withMaintenanceModeConfiguration(maintenanceModeConfiguration); + return this; + } + + public CommunityResourceImpl withProperties(UpdateCommunityPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + public CommunityResourceImpl withIdentity(AzureResourceManagerCommonTypesManagedServiceIdentityUpdate identity) { + this.updateProperties.withIdentity(identity); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveConnectionResourceImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveConnectionResourceImpl.java new file mode 100644 index 000000000000..25b978a53d31 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveConnectionResourceImpl.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.EnclaveConnectionResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackResponse; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackResponse; +import com.azure.resourcemanager.mission.models.EnclaveConnectionPatchResource; +import com.azure.resourcemanager.mission.models.EnclaveConnectionResource; +import com.azure.resourcemanager.mission.models.EnclaveConnectionState; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.UpdateEnclaveConnectionPatchProperties; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class EnclaveConnectionResourceImpl + implements EnclaveConnectionResource, EnclaveConnectionResource.Definition, EnclaveConnectionResource.Update { + private EnclaveConnectionResourceInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public EnclaveConnectionState state() { + return this.innerModel().state(); + } + + public String communityResourceId() { + return this.innerModel().communityResourceId(); + } + + public String sourceResourceId() { + return this.innerModel().sourceResourceId(); + } + + public String sourceCidr() { + return this.innerModel().sourceCidr(); + } + + public String ipGroup() { + return this.innerModel().ipGroup(); + } + + public String destinationEndpointId() { + return this.innerModel().destinationEndpointId(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List resourceCollection() { + List inner = this.innerModel().resourceCollection(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + 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.mission.MissionManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String enclaveConnectionName; + + private EnclaveConnectionPatchResource 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.mission.MissionManager serviceManager) { + this.innerObject = new EnclaveConnectionResourceInner(); + this.serviceManager = serviceManager; + this.enclaveConnectionName = name; + } + + public EnclaveConnectionResourceImpl update() { + this.updateProperties = new EnclaveConnectionPatchResource(); + 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.mission.MissionManager 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 ApprovalCallbackResponse approvalCallback(ApprovalCallbackRequest body) { + return serviceManager.enclaveConnections().approvalCallback(resourceGroupName, enclaveConnectionName, body); + } + + public ApprovalCallbackResponse approvalCallback(ApprovalCallbackRequest body, Context context) { + return serviceManager.enclaveConnections() + .approvalCallback(resourceGroupName, enclaveConnectionName, body, context); + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body) { + return serviceManager.enclaveConnections() + .approvalDeletionCallback(resourceGroupName, enclaveConnectionName, body); + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body, + Context context) { + return serviceManager.enclaveConnections() + .approvalDeletionCallback(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 withState(EnclaveConnectionState state) { + this.innerModel().withState(state); + return this; + } + + public EnclaveConnectionResourceImpl withCommunityResourceId(String communityResourceId) { + this.innerModel().withCommunityResourceId(communityResourceId); + return this; + } + + public EnclaveConnectionResourceImpl withSourceResourceId(String sourceResourceId) { + this.innerModel().withSourceResourceId(sourceResourceId); + return this; + } + + public EnclaveConnectionResourceImpl withSourceCidr(String sourceCidr) { + this.innerModel().withSourceCidr(sourceCidr); + return this; + } + + public EnclaveConnectionResourceImpl withIpGroup(String ipGroup) { + this.innerModel().withIpGroup(ipGroup); + return this; + } + + public EnclaveConnectionResourceImpl withDestinationEndpointId(String destinationEndpointId) { + this.innerModel().withDestinationEndpointId(destinationEndpointId); + return this; + } + + public EnclaveConnectionResourceImpl withResourceCollection(List resourceCollection) { + this.innerModel().withResourceCollection(resourceCollection); + return this; + } + + public EnclaveConnectionResourceImpl withProperties(UpdateEnclaveConnectionPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveConnectionsClientImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveConnectionsClientImpl.java new file mode 100644 index 000000000000..8b4fff8ff5f0 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveConnectionsClientImpl.java @@ -0,0 +1,1819 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.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.mission.fluent.EnclaveConnectionsClient; +import com.azure.resourcemanager.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.EnclaveConnectionResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.EnclaveConnectionPatchResource; +import com.azure.resourcemanager.mission.models.EnclaveConnectionResourceListResult; +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 MissionClientImpl client; + + /** + * Initializes an instance of EnclaveConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnclaveConnectionsClientImpl(MissionClientImpl client) { + this.service = RestProxy.create(EnclaveConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MissionClientEnclaveConnections to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MissionClientEnclave") + public interface EnclaveConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/enclaveConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") 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/{enclaveConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") 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" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @BodyParam("application/json") EnclaveConnectionResourceInner resource, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @BodyParam("application/json") EnclaveConnectionPatchResource properties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") 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" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}/approvalCallback") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> approvalCallback(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @BodyParam("application/json") ApprovalCallbackRequest body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/enclaveConnections/{enclaveConnectionName}/approvalDeletionCallback") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> approvalDeletionCallback(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("enclaveConnectionName") String enclaveConnectionName, + @BodyParam("application/json") ApprovalDeletionCallbackRequest body, @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("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context 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() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + 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. + * + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(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 as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * 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<>(listAsync(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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, + Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, 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 ManagementException thrown 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<>(listByResourceGroupAsync(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 ManagementException thrown 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<>(listByResourceGroupAsync(resourceGroupName, 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(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 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) { + return getByResourceGroupWithResponseAsync(resourceGroupName, enclaveConnectionName, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, resource, accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, EnclaveConnectionResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, resource, accept, 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. + * @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 PollerFlux} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnclaveConnectionResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, enclaveConnectionName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, enclaveConnectionName, resource).getSyncPoller(); + } + + /** + * 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, enclaveConnectionName, resource, context) + .getSyncPoller(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String enclaveConnectionName, EnclaveConnectionResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, enclaveConnectionName, resource, context).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 createOrUpdateAsync(resourceGroupName, enclaveConnectionName, resource).block(); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, enclaveConnectionName, resource, context).block(); + } + + /** + * 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, EnclaveConnectionPatchResource properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, properties, accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, EnclaveConnectionPatchResource properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, enclaveConnectionName, properties, accept, 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, EnclaveConnectionPatchResource 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. + * @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 PollerFlux} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnclaveConnectionResourceInner> beginUpdateAsync( + String resourceGroupName, String enclaveConnectionName, EnclaveConnectionPatchResource properties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, enclaveConnectionName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 the {@link SyncPoller} for polling of enclaveConnection Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveConnectionResourceInner> + beginUpdate(String resourceGroupName, String enclaveConnectionName, EnclaveConnectionPatchResource properties) { + return this.beginUpdateAsync(resourceGroupName, enclaveConnectionName, properties).getSyncPoller(); + } + + /** + * 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, EnclaveConnectionPatchResource properties, + Context context) { + return this.beginUpdateAsync(resourceGroupName, enclaveConnectionName, properties, context).getSyncPoller(); + } + + /** + * 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, + EnclaveConnectionPatchResource 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String enclaveConnectionName, + EnclaveConnectionPatchResource properties, Context context) { + return beginUpdateAsync(resourceGroupName, enclaveConnectionName, properties, context).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, + EnclaveConnectionPatchResource properties) { + return updateAsync(resourceGroupName, enclaveConnectionName, properties).block(); + } + + /** + * 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, + EnclaveConnectionPatchResource properties, Context context) { + return updateAsync(resourceGroupName, enclaveConnectionName, properties, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, accept, 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. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, enclaveConnectionName, accept, 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. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String enclaveConnectionName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, enclaveConnectionName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String enclaveConnectionName) { + return this.beginDeleteAsync(resourceGroupName, enclaveConnectionName).getSyncPoller(); + } + + /** + * 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) { + return this.beginDeleteAsync(resourceGroupName, enclaveConnectionName, context).getSyncPoller(); + } + + /** + * 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. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String enclaveConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, enclaveConnectionName, context).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) { + deleteAsync(resourceGroupName, enclaveConnectionName).block(); + } + + /** + * 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) { + deleteAsync(resourceGroupName, enclaveConnectionName, context).block(); + } + + /** + * 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 response body after handling of approvalCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalCallbackWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalCallbackRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.approvalCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, body, accept, 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. + * @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 body after handling of approvalCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalCallbackWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalCallbackRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.approvalCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, body, accept, 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalCallbackResponseInner> + beginApprovalCallbackAsync(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body) { + Mono>> mono + = approvalCallbackWithResponseAsync(resourceGroupName, enclaveConnectionName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalCallbackResponseInner.class, ApprovalCallbackResponseInner.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. + * @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 PollerFlux} for polling of response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalCallbackResponseInner> + beginApprovalCallbackAsync(String resourceGroupName, String enclaveConnectionName, ApprovalCallbackRequest body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = approvalCallbackWithResponseAsync(resourceGroupName, enclaveConnectionName, body, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalCallbackResponseInner.class, ApprovalCallbackResponseInner.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 {@link SyncPoller} for polling of response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalCallbackResponseInner> + beginApprovalCallback(String resourceGroupName, String enclaveConnectionName, ApprovalCallbackRequest body) { + return this.beginApprovalCallbackAsync(resourceGroupName, enclaveConnectionName, body).getSyncPoller(); + } + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + String resourceGroupName, String enclaveConnectionName, ApprovalCallbackRequest body, Context context) { + return this.beginApprovalCallbackAsync(resourceGroupName, enclaveConnectionName, body, context).getSyncPoller(); + } + + /** + * 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 response body after handling of approvalCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalCallbackAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalCallbackRequest body) { + return beginApprovalCallbackAsync(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. + * @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 body after handling of approvalCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalCallbackAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalCallbackRequest body, Context context) { + return beginApprovalCallbackAsync(resourceGroupName, enclaveConnectionName, body, context).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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalCallbackResponseInner approvalCallback(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body) { + return approvalCallbackAsync(resourceGroupName, enclaveConnectionName, body).block(); + } + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalCallbackResponseInner approvalCallback(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body, Context context) { + return approvalCallbackAsync(resourceGroupName, enclaveConnectionName, body, context).block(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalDeletionCallbackWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.approvalDeletionCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, body, accept, 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. + * @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 body after handling of approvalDeletionCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalDeletionCallbackWithResponseAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (enclaveConnectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveConnectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.approvalDeletionCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, enclaveConnectionName, body, accept, 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallbackAsync(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body) { + Mono>> mono + = approvalDeletionCallbackWithResponseAsync(resourceGroupName, enclaveConnectionName, body); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), ApprovalDeletionCallbackResponseInner.class, + ApprovalDeletionCallbackResponseInner.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. + * @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 PollerFlux} for polling of response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallbackAsync(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = approvalDeletionCallbackWithResponseAsync(resourceGroupName, enclaveConnectionName, body, context); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), ApprovalDeletionCallbackResponseInner.class, + ApprovalDeletionCallbackResponseInner.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 {@link SyncPoller} for polling of response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body) { + return this.beginApprovalDeletionCallbackAsync(resourceGroupName, enclaveConnectionName, body).getSyncPoller(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(String resourceGroupName, String enclaveConnectionName, + ApprovalDeletionCallbackRequest body, Context context) { + return this.beginApprovalDeletionCallbackAsync(resourceGroupName, enclaveConnectionName, body, context) + .getSyncPoller(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalDeletionCallbackAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body) { + return beginApprovalDeletionCallbackAsync(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. + * @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 body after handling of approvalDeletionCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalDeletionCallbackAsync(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body, Context context) { + return beginApprovalDeletionCallbackAsync(resourceGroupName, enclaveConnectionName, body, context).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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body) { + return approvalDeletionCallbackAsync(resourceGroupName, enclaveConnectionName, body).block(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body, Context context) { + return approvalDeletionCallbackAsync(resourceGroupName, enclaveConnectionName, body, context).block(); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveConnectionsImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveConnectionsImpl.java new file mode 100644 index 000000000000..9f052cd4c3e8 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveConnectionsImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.EnclaveConnectionsClient; +import com.azure.resourcemanager.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.EnclaveConnectionResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackResponse; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackResponse; +import com.azure.resourcemanager.mission.models.EnclaveConnectionResource; +import com.azure.resourcemanager.mission.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.mission.MissionManager serviceManager; + + public EnclaveConnectionsImpl(EnclaveConnectionsClient innerClient, + com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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 ApprovalCallbackResponse approvalCallback(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body) { + ApprovalCallbackResponseInner inner + = this.serviceClient().approvalCallback(resourceGroupName, enclaveConnectionName, body); + if (inner != null) { + return new ApprovalCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalCallbackResponse approvalCallback(String resourceGroupName, String enclaveConnectionName, + ApprovalCallbackRequest body, Context context) { + ApprovalCallbackResponseInner inner + = this.serviceClient().approvalCallback(resourceGroupName, enclaveConnectionName, body, context); + if (inner != null) { + return new ApprovalCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body) { + ApprovalDeletionCallbackResponseInner inner + = this.serviceClient().approvalDeletionCallback(resourceGroupName, enclaveConnectionName, body); + if (inner != null) { + return new ApprovalDeletionCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(String resourceGroupName, + String enclaveConnectionName, ApprovalDeletionCallbackRequest body, Context context) { + ApprovalDeletionCallbackResponseInner inner + = this.serviceClient().approvalDeletionCallback(resourceGroupName, enclaveConnectionName, body, context); + if (inner != null) { + return new ApprovalDeletionCallbackResponseImpl(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.mission.MissionManager manager() { + return this.serviceManager; + } + + public EnclaveConnectionResourceImpl define(String name) { + return new EnclaveConnectionResourceImpl(name, this.manager()); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveEndpointResourceImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveEndpointResourceImpl.java new file mode 100644 index 000000000000..84f881b59f25 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveEndpointResourceImpl.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.EnclaveEndpointResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackResponse; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackResponse; +import com.azure.resourcemanager.mission.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.EnclaveEndpointPatchResource; +import com.azure.resourcemanager.mission.models.EnclaveEndpointResource; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.UpdateEnclaveEndpointPatchProperties; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class EnclaveEndpointResourceImpl + implements EnclaveEndpointResource, EnclaveEndpointResource.Definition, EnclaveEndpointResource.Update { + private EnclaveEndpointResourceInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public List ruleCollection() { + List inner = this.innerModel().ruleCollection(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List resourceCollection() { + List inner = this.innerModel().resourceCollection(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + 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.mission.MissionManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualEnclaveName; + + private String enclaveEndpointName; + + private EnclaveEndpointPatchResource 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.mission.MissionManager serviceManager) { + this.innerObject = new EnclaveEndpointResourceInner(); + this.serviceManager = serviceManager; + this.enclaveEndpointName = name; + } + + public EnclaveEndpointResourceImpl update() { + this.updateProperties = new EnclaveEndpointPatchResource(); + 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.mission.MissionManager 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 ApprovalCallbackResponse approvalCallback(ApprovalCallbackRequest body) { + return serviceManager.enclaveEndpoints() + .approvalCallback(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + } + + public ApprovalCallbackResponse approvalCallback(ApprovalCallbackRequest body, Context context) { + return serviceManager.enclaveEndpoints() + .approvalCallback(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context); + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body) { + return serviceManager.enclaveEndpoints() + .approvalDeletionCallback(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body, + Context context) { + return serviceManager.enclaveEndpoints() + .approvalDeletionCallback(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 withRuleCollection(List ruleCollection) { + this.innerModel().withRuleCollection(ruleCollection); + return this; + } + + public EnclaveEndpointResourceImpl withResourceCollection(List resourceCollection) { + this.innerModel().withResourceCollection(resourceCollection); + return this; + } + + public EnclaveEndpointResourceImpl withProperties(UpdateEnclaveEndpointPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveEndpointsClientImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveEndpointsClientImpl.java new file mode 100644 index 000000000000..ee5dbf5c02dd --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveEndpointsClientImpl.java @@ -0,0 +1,2002 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.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.mission.fluent.EnclaveEndpointsClient; +import com.azure.resourcemanager.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.EnclaveEndpointResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.EnclaveEndpointPatchResource; +import com.azure.resourcemanager.mission.models.EnclaveEndpointResourceListResult; +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 MissionClientImpl client; + + /** + * Initializes an instance of EnclaveEndpointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EnclaveEndpointsClientImpl(MissionClientImpl client) { + this.service + = RestProxy.create(EnclaveEndpointsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MissionClientEnclaveEndpoints to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MissionClientEnclave") + public interface EnclaveEndpointsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("$host") 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByEnclaveResource(@HostParam("$host") 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/{enclaveEndpointName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @BodyParam("application/json") EnclaveEndpointResourceInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @BodyParam("application/json") EnclaveEndpointPatchResource properties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "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("$host") 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" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}/approvalCallback") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> approvalCallback(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @BodyParam("application/json") ApprovalCallbackRequest body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/enclaveEndpoints/{enclaveEndpointName}/approvalDeletionCallback") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> approvalDeletionCallback(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @PathParam("enclaveEndpointName") String enclaveEndpointName, + @BodyParam("application/json") ApprovalDeletionCallbackRequest body, @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("$host") String endpoint, + @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("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySubscriptionSinglePageAsync(String virtualEnclaveName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String virtualEnclaveName, + Context context) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(virtualEnclaveName, context), + nextLink -> listBySubscriptionNextSinglePageAsync(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 as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String virtualEnclaveName) { + return new PagedIterable<>(listBySubscriptionAsync(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 ManagementException thrown 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<>(listBySubscriptionAsync(virtualEnclaveName, 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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByEnclaveResourceSinglePageAsync(String resourceGroupName, String virtualEnclaveName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByEnclaveResourceAsync(String resourceGroupName, + String virtualEnclaveName, Context context) { + return new PagedFlux<>( + () -> listByEnclaveResourceSinglePageAsync(resourceGroupName, virtualEnclaveName, context), + nextLink -> listByEnclaveResourceNextSinglePageAsync(nextLink, 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 ManagementException thrown 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<>(listByEnclaveResourceAsync(resourceGroupName, 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 ManagementException thrown 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<>(listByEnclaveResourceAsync(resourceGroupName, virtualEnclaveName, 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(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 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) { + return getWithResponseAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource, + accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, EnclaveEndpointResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource, + accept, 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. + * @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 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, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, virtualEnclaveName, + enclaveEndpointName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource) + .getSyncPoller(); + } + + /** + * 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) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource, context) + .getSyncPoller(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource, context) + .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 createOrUpdateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource).block(); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, resource, context) + .block(); + } + + /** + * 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, EnclaveEndpointPatchResource properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties, + accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, EnclaveEndpointPatchResource properties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties, accept, 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, + EnclaveEndpointPatchResource 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. + * @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 PollerFlux} for polling of enclaveEndpoint Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnclaveEndpointResourceInner> beginUpdateAsync( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + EnclaveEndpointPatchResource properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 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, + EnclaveEndpointPatchResource properties) { + return this.beginUpdateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties) + .getSyncPoller(); + } + + /** + * 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, + EnclaveEndpointPatchResource properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties, context) + .getSyncPoller(); + } + + /** + * 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, EnclaveEndpointPatchResource 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, EnclaveEndpointPatchResource properties, Context context) { + return beginUpdateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties, context).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, EnclaveEndpointPatchResource properties) { + return updateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties).block(); + } + + /** + * 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, EnclaveEndpointPatchResource properties, Context context) { + return updateAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, properties, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, accept, + 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. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, virtualEnclaveName, enclaveEndpointName, accept, 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. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), 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 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) { + return this.beginDeleteAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName).getSyncPoller(); + } + + /** + * 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) { + return this.beginDeleteAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context) + .getSyncPoller(); + } + + /** + * 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. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + Context context) { + return beginDeleteAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context).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) { + deleteAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName).block(); + } + + /** + * 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) { + deleteAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, context).block(); + } + + /** + * 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 response body after handling of approvalCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalCallbackWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.approvalCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, + accept, 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. + * @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 body after handling of approvalCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalCallbackWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.approvalCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, accept, + 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalCallbackResponseInner> + beginApprovalCallbackAsync(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + ApprovalCallbackRequest body) { + Mono>> mono + = approvalCallbackWithResponseAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalCallbackResponseInner.class, ApprovalCallbackResponseInner.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. + * @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 PollerFlux} for polling of response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalCallbackResponseInner> + beginApprovalCallbackAsync(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + ApprovalCallbackRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = approvalCallbackWithResponseAsync(resourceGroupName, virtualEnclaveName, + enclaveEndpointName, body, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalCallbackResponseInner.class, ApprovalCallbackResponseInner.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 {@link SyncPoller} for polling of response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body) { + return this.beginApprovalCallbackAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body) + .getSyncPoller(); + } + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body, + Context context) { + return this + .beginApprovalCallbackAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context) + .getSyncPoller(); + } + + /** + * 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 response body after handling of approvalCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalCallbackAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body) { + return beginApprovalCallbackAsync(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. + * @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 body after handling of approvalCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalCallbackAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalCallbackRequest body, Context context) { + return beginApprovalCallbackAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context) + .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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalCallbackResponseInner approvalCallback(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body) { + return approvalCallbackAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body).block(); + } + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalCallbackResponseInner approvalCallback(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body, Context context) { + return approvalCallbackAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context).block(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalDeletionCallbackWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalDeletionCallbackRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.approvalDeletionCallback(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, + enclaveEndpointName, body, accept, 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. + * @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 body after handling of approvalDeletionCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalDeletionCallbackWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (enclaveEndpointName == null) { + return Mono + .error(new IllegalArgumentException("Parameter enclaveEndpointName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.approvalDeletionCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, accept, + 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallbackAsync(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body) { + Mono>> mono = approvalDeletionCallbackWithResponseAsync(resourceGroupName, + virtualEnclaveName, enclaveEndpointName, body); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), ApprovalDeletionCallbackResponseInner.class, + ApprovalDeletionCallbackResponseInner.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. + * @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 PollerFlux} for polling of response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallbackAsync(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = approvalDeletionCallbackWithResponseAsync(resourceGroupName, + virtualEnclaveName, enclaveEndpointName, body, context); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), ApprovalDeletionCallbackResponseInner.class, + ApprovalDeletionCallbackResponseInner.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 {@link SyncPoller} for polling of response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + ApprovalDeletionCallbackRequest body) { + return this.beginApprovalDeletionCallbackAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body) + .getSyncPoller(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(String resourceGroupName, String virtualEnclaveName, String enclaveEndpointName, + ApprovalDeletionCallbackRequest body, Context context) { + return this + .beginApprovalDeletionCallbackAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, + context) + .getSyncPoller(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalDeletionCallbackAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalDeletionCallbackRequest body) { + return beginApprovalDeletionCallbackAsync(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. + * @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 body after handling of approvalDeletionCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalDeletionCallbackAsync(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + return beginApprovalDeletionCallbackAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, + context).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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalDeletionCallbackRequest body) { + return approvalDeletionCallbackAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body).block(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + return approvalDeletionCallbackAsync(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context) + .block(); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByEnclaveResourceNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveEndpointsImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveEndpointsImpl.java new file mode 100644 index 000000000000..d9ac96f14db0 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveEndpointsImpl.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.EnclaveEndpointsClient; +import com.azure.resourcemanager.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.EnclaveEndpointResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackResponse; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackResponse; +import com.azure.resourcemanager.mission.models.EnclaveEndpointResource; +import com.azure.resourcemanager.mission.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.mission.MissionManager serviceManager; + + public EnclaveEndpointsImpl(EnclaveEndpointsClient innerClient, + com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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 ApprovalCallbackResponse approvalCallback(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body) { + ApprovalCallbackResponseInner inner + = this.serviceClient().approvalCallback(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + if (inner != null) { + return new ApprovalCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalCallbackResponse approvalCallback(String resourceGroupName, String virtualEnclaveName, + String enclaveEndpointName, ApprovalCallbackRequest body, Context context) { + ApprovalCallbackResponseInner inner = this.serviceClient() + .approvalCallback(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context); + if (inner != null) { + return new ApprovalCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalDeletionCallbackRequest body) { + ApprovalDeletionCallbackResponseInner inner = this.serviceClient() + .approvalDeletionCallback(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body); + if (inner != null) { + return new ApprovalDeletionCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(String resourceGroupName, + String virtualEnclaveName, String enclaveEndpointName, ApprovalDeletionCallbackRequest body, Context context) { + ApprovalDeletionCallbackResponseInner inner = this.serviceClient() + .approvalDeletionCallback(resourceGroupName, virtualEnclaveName, enclaveEndpointName, body, context); + if (inner != null) { + return new ApprovalDeletionCallbackResponseImpl(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.mission.MissionManager manager() { + return this.serviceManager; + } + + public EnclaveEndpointResourceImpl define(String name) { + return new EnclaveEndpointResourceImpl(name, this.manager()); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveResourceImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveResourceImpl.java new file mode 100644 index 000000000000..ea83044871b5 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/EnclaveResourceImpl.java @@ -0,0 +1,325 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.EnclaveResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackResponse; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackResponse; +import com.azure.resourcemanager.mission.models.AzureResourceManagerCommonTypesManagedServiceIdentityUpdate; +import com.azure.resourcemanager.mission.models.EnclaveAddressSpaces; +import com.azure.resourcemanager.mission.models.EnclaveDefaultSettings; +import com.azure.resourcemanager.mission.models.EnclaveResource; +import com.azure.resourcemanager.mission.models.EnclaveVirtualNetwork; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfiguration; +import com.azure.resourcemanager.mission.models.ManagedResourceGroupConfiguration; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentity; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import com.azure.resourcemanager.mission.models.UpdateVirtualEnclavePatchProperties; +import com.azure.resourcemanager.mission.models.VirtualEnclavePatchResource; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class EnclaveResourceImpl implements EnclaveResource, EnclaveResource.Definition, EnclaveResource.Update { + private EnclaveResourceInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager 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 ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public EnclaveVirtualNetwork enclaveVirtualNetwork() { + return this.innerModel().enclaveVirtualNetwork(); + } + + public EnclaveAddressSpaces enclaveAddressSpaces() { + return this.innerModel().enclaveAddressSpaces(); + } + + public String communityResourceId() { + return this.innerModel().communityResourceId(); + } + + public EnclaveDefaultSettings enclaveDefaultSettings() { + return this.innerModel().enclaveDefaultSettings(); + } + + public List resourceCollection() { + List inner = this.innerModel().resourceCollection(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ManagedResourceGroupConfiguration managedResourceGroupConfiguration() { + return this.innerModel().managedResourceGroupConfiguration(); + } + + public MaintenanceModeConfiguration maintenanceModeConfiguration() { + return this.innerModel().maintenanceModeConfiguration(); + } + + public Boolean bastionEnabled() { + return this.innerModel().bastionEnabled(); + } + + public List enclaveRoleAssignments() { + List inner = this.innerModel().enclaveRoleAssignments(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List workloadRoleAssignments() { + List inner = this.innerModel().workloadRoleAssignments(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + 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.mission.MissionManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualEnclaveName; + + private VirtualEnclavePatchResource 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.mission.MissionManager serviceManager) { + this.innerObject = new EnclaveResourceInner(); + this.serviceManager = serviceManager; + this.virtualEnclaveName = name; + } + + public EnclaveResourceImpl update() { + this.updateProperties = new VirtualEnclavePatchResource(); + 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.mission.MissionManager 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 ApprovalCallbackResponse approvalCallback(ApprovalCallbackRequest body) { + return serviceManager.virtualEnclaves().approvalCallback(resourceGroupName, virtualEnclaveName, body); + } + + public ApprovalCallbackResponse approvalCallback(ApprovalCallbackRequest body, Context context) { + return serviceManager.virtualEnclaves().approvalCallback(resourceGroupName, virtualEnclaveName, body, context); + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body) { + return serviceManager.virtualEnclaves().approvalDeletionCallback(resourceGroupName, virtualEnclaveName, body); + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body, + Context context) { + return serviceManager.virtualEnclaves() + .approvalDeletionCallback(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 withIdentity(ManagedServiceIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public EnclaveResourceImpl withEnclaveVirtualNetwork(EnclaveVirtualNetwork enclaveVirtualNetwork) { + this.innerModel().withEnclaveVirtualNetwork(enclaveVirtualNetwork); + return this; + } + + public EnclaveResourceImpl withCommunityResourceId(String communityResourceId) { + this.innerModel().withCommunityResourceId(communityResourceId); + return this; + } + + public EnclaveResourceImpl withEnclaveDefaultSettings(EnclaveDefaultSettings enclaveDefaultSettings) { + this.innerModel().withEnclaveDefaultSettings(enclaveDefaultSettings); + return this; + } + + public EnclaveResourceImpl withResourceCollection(List resourceCollection) { + this.innerModel().withResourceCollection(resourceCollection); + return this; + } + + public EnclaveResourceImpl + withManagedResourceGroupConfiguration(ManagedResourceGroupConfiguration managedResourceGroupConfiguration) { + this.innerModel().withManagedResourceGroupConfiguration(managedResourceGroupConfiguration); + return this; + } + + public EnclaveResourceImpl + withMaintenanceModeConfiguration(MaintenanceModeConfiguration maintenanceModeConfiguration) { + this.innerModel().withMaintenanceModeConfiguration(maintenanceModeConfiguration); + return this; + } + + public EnclaveResourceImpl withBastionEnabled(Boolean bastionEnabled) { + this.innerModel().withBastionEnabled(bastionEnabled); + return this; + } + + public EnclaveResourceImpl withEnclaveRoleAssignments(List enclaveRoleAssignments) { + this.innerModel().withEnclaveRoleAssignments(enclaveRoleAssignments); + return this; + } + + public EnclaveResourceImpl withWorkloadRoleAssignments(List workloadRoleAssignments) { + this.innerModel().withWorkloadRoleAssignments(workloadRoleAssignments); + return this; + } + + public EnclaveResourceImpl withProperties(UpdateVirtualEnclavePatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + public EnclaveResourceImpl withIdentity(AzureResourceManagerCommonTypesManagedServiceIdentityUpdate identity) { + this.updateProperties.withIdentity(identity); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/InitiatorCallbackResponseImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/InitiatorCallbackResponseImpl.java new file mode 100644 index 000000000000..f3324182fee4 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/InitiatorCallbackResponseImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.resourcemanager.mission.fluent.models.InitiatorCallbackResponseInner; +import com.azure.resourcemanager.mission.models.InitiatorCallbackResponse; + +public final class InitiatorCallbackResponseImpl implements InitiatorCallbackResponse { + private InitiatorCallbackResponseInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager serviceManager; + + InitiatorCallbackResponseImpl(InitiatorCallbackResponseInner innerObject, + com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String message() { + return this.innerModel().message(); + } + + public InitiatorCallbackResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.mission.MissionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/MissionClientBuilder.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/MissionClientBuilder.java new file mode 100644 index 000000000000..8c6dd4aaea02 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/MissionClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 MissionClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { MissionClientImpl.class }) +public final class MissionClientBuilder { + /* + * 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 MissionClientBuilder. + */ + public MissionClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MissionClientBuilder. + */ + public MissionClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the MissionClientBuilder. + */ + public MissionClientBuilder 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 MissionClientBuilder. + */ + public MissionClientBuilder 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 MissionClientBuilder. + */ + public MissionClientBuilder 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 MissionClientBuilder. + */ + public MissionClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MissionClientImpl with the provided parameters. + * + * @return an instance of MissionClientImpl. + */ + public MissionClientImpl 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(); + MissionClientImpl client = new MissionClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/MissionClientImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/MissionClientImpl.java new file mode 100644 index 000000000000..dcc3ebc2db96 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/MissionClientImpl.java @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.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.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.mission.fluent.ApprovalsClient; +import com.azure.resourcemanager.mission.fluent.CommunitiesClient; +import com.azure.resourcemanager.mission.fluent.CommunityEndpointsClient; +import com.azure.resourcemanager.mission.fluent.EnclaveConnectionsClient; +import com.azure.resourcemanager.mission.fluent.EnclaveEndpointsClient; +import com.azure.resourcemanager.mission.fluent.MissionClient; +import com.azure.resourcemanager.mission.fluent.OperationsClient; +import com.azure.resourcemanager.mission.fluent.TransitHubsClient; +import com.azure.resourcemanager.mission.fluent.VirtualEnclavesClient; +import com.azure.resourcemanager.mission.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 MissionClientImpl type. + */ +@ServiceClient(builder = MissionClientBuilder.class) +public final class MissionClientImpl implements MissionClient { + /** + * 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; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * 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 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; + } + + /** + * 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 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 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 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 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 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 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; + } + + /** + * Initializes an instance of MissionClient 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 subscriptionId The ID of the target subscription. The value must be an UUID. + * @param endpoint server parameter. + */ + MissionClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, Duration defaultPollInterval, + AzureEnvironment environment, String subscriptionId, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2024-12-01-preview"; + this.approvals = new ApprovalsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.communities = new CommunitiesClientImpl(this); + this.communityEndpoints = new CommunityEndpointsClientImpl(this); + this.transitHubs = new TransitHubsClientImpl(this); + this.enclaveConnections = new EnclaveConnectionsClientImpl(this); + this.virtualEnclaves = new VirtualEnclavesClientImpl(this); + this.enclaveEndpoints = new EnclaveEndpointsClientImpl(this); + this.workloads = new WorkloadsClientImpl(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 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(MissionClientImpl.class); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/OperationImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/OperationImpl.java new file mode 100644 index 000000000000..6a001afc7f49 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.resourcemanager.mission.fluent.models.OperationInner; +import com.azure.resourcemanager.mission.models.ActionType; +import com.azure.resourcemanager.mission.models.Operation; +import com.azure.resourcemanager.mission.models.OperationDisplay; +import com.azure.resourcemanager.mission.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.mission.MissionManager 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.mission.MissionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/OperationsClientImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..0f01fff174b8 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.OperationsClient; +import com.azure.resourcemanager.mission.fluent.models.OperationInner; +import com.azure.resourcemanager.mission.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 MissionClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MissionClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MissionClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MissionClientOperati") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Mission/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") 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("$host") 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() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * + * @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} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, 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 as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * 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<>(listAsync(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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/OperationsImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/OperationsImpl.java new file mode 100644 index 000000000000..dadb37daa44b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.OperationsClient; +import com.azure.resourcemanager.mission.fluent.models.OperationInner; +import com.azure.resourcemanager.mission.models.Operation; +import com.azure.resourcemanager.mission.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.mission.MissionManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.mission.MissionManager 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.mission.MissionManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ResourceManagerUtils.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..073934a777c7 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/TransitHubResourceImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/TransitHubResourceImpl.java new file mode 100644 index 000000000000..e155fbf51dc5 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/TransitHubResourceImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.TransitHubResourceInner; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.TransitHubPatchResource; +import com.azure.resourcemanager.mission.models.TransitHubResource; +import com.azure.resourcemanager.mission.models.TransitHubState; +import com.azure.resourcemanager.mission.models.TransitOption; +import com.azure.resourcemanager.mission.models.UpdateTransitHubPatchProperties; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class TransitHubResourceImpl + implements TransitHubResource, TransitHubResource.Definition, TransitHubResource.Update { + private TransitHubResourceInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public TransitHubState state() { + return this.innerModel().state(); + } + + public TransitOption transitOption() { + return this.innerModel().transitOption(); + } + + public List resourceCollection() { + List inner = this.innerModel().resourceCollection(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + 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.mission.MissionManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String communityName; + + private String transitHubName; + + private TransitHubPatchResource 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.mission.MissionManager serviceManager) { + this.innerObject = new TransitHubResourceInner(); + this.serviceManager = serviceManager; + this.transitHubName = name; + } + + public TransitHubResourceImpl update() { + this.updateProperties = new TransitHubPatchResource(); + 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.mission.MissionManager 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 withState(TransitHubState state) { + this.innerModel().withState(state); + return this; + } + + public TransitHubResourceImpl withTransitOption(TransitOption transitOption) { + this.innerModel().withTransitOption(transitOption); + return this; + } + + public TransitHubResourceImpl withResourceCollection(List resourceCollection) { + this.innerModel().withResourceCollection(resourceCollection); + return this; + } + + public TransitHubResourceImpl withProperties(UpdateTransitHubPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/TransitHubsClientImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/TransitHubsClientImpl.java new file mode 100644 index 000000000000..0a2e4fa0b4f6 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/TransitHubsClientImpl.java @@ -0,0 +1,1390 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.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.mission.fluent.TransitHubsClient; +import com.azure.resourcemanager.mission.fluent.models.TransitHubResourceInner; +import com.azure.resourcemanager.mission.models.TransitHubPatchResource; +import com.azure.resourcemanager.mission.models.TransitHubResourceListResult; +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 MissionClientImpl client; + + /** + * Initializes an instance of TransitHubsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TransitHubsClientImpl(MissionClientImpl client) { + this.service + = RestProxy.create(TransitHubsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MissionClientTransitHubs to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MissionClientTransit") + public interface TransitHubsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/communities/{communityName}/transitHubs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("$host") 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCommunityResource(@HostParam("$host") 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/{transitHubName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs/{transitHubName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("transitHubName") String transitHubName, + @BodyParam("application/json") TransitHubResourceInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/communities/{communityName}/transitHubs/{transitHubName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("communityName") String communityName, + @PathParam("transitHubName") String transitHubName, + @BodyParam("application/json") TransitHubPatchResource properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "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("$host") 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("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @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("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(String communityName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String communityName, Context context) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(communityName, context), + nextLink -> listBySubscriptionNextSinglePageAsync(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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String communityName) { + return new PagedIterable<>(listBySubscriptionAsync(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 ManagementException thrown 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<>(listBySubscriptionAsync(communityName, 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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCommunityResourceSinglePageAsync(String resourceGroupName, String communityName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCommunityResourceAsync(String resourceGroupName, + String communityName, Context context) { + return new PagedFlux<>(() -> listByCommunityResourceSinglePageAsync(resourceGroupName, communityName, context), + nextLink -> listByCommunityResourceNextSinglePageAsync(nextLink, 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 ManagementException thrown 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<>(listByCommunityResourceAsync(resourceGroupName, 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 ManagementException thrown 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<>(listByCommunityResourceAsync(resourceGroupName, communityName, 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (transitHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter transitHubName is required and cannot be null.")); + } + 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String communityName, + String transitHubName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (transitHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter transitHubName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(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 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) { + return getWithResponseAsync(resourceGroupName, communityName, transitHubName, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (transitHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter transitHubName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, resource, accept, + 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String communityName, String transitHubName, TransitHubResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (transitHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter transitHubName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, resource, accept, + 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. + * @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 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, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, communityName, transitHubName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, communityName, transitHubName, resource) + .getSyncPoller(); + } + + /** + * 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, communityName, transitHubName, resource, context) + .getSyncPoller(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String communityName, + String transitHubName, TransitHubResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, communityName, transitHubName, resource, context).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 createOrUpdateAsync(resourceGroupName, communityName, transitHubName, resource).block(); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, communityName, transitHubName, resource, context).block(); + } + + /** + * 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, TransitHubPatchResource properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (transitHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter transitHubName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, properties, accept, + 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String communityName, + String transitHubName, TransitHubPatchResource properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (transitHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter transitHubName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communityName, transitHubName, properties, accept, 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, TransitHubPatchResource 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. + * @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 PollerFlux} for polling of transitHub Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TransitHubResourceInner> beginUpdateAsync( + String resourceGroupName, String communityName, String transitHubName, TransitHubPatchResource properties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, communityName, transitHubName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 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, TransitHubPatchResource properties) { + return this.beginUpdateAsync(resourceGroupName, communityName, transitHubName, properties).getSyncPoller(); + } + + /** + * 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, TransitHubPatchResource properties, + Context context) { + return this.beginUpdateAsync(resourceGroupName, communityName, transitHubName, properties, context) + .getSyncPoller(); + } + + /** + * 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, TransitHubPatchResource 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String communityName, + String transitHubName, TransitHubPatchResource properties, Context context) { + return beginUpdateAsync(resourceGroupName, communityName, transitHubName, properties, context).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, + TransitHubPatchResource properties) { + return updateAsync(resourceGroupName, communityName, transitHubName, properties).block(); + } + + /** + * 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, + TransitHubPatchResource properties, Context context) { + return updateAsync(resourceGroupName, communityName, transitHubName, properties, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (transitHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter transitHubName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, communityName, transitHubName, accept, 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. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String communityName, + String transitHubName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (communityName == null) { + return Mono.error(new IllegalArgumentException("Parameter communityName is required and cannot be null.")); + } + if (transitHubName == null) { + return Mono.error(new IllegalArgumentException("Parameter transitHubName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, communityName, transitHubName, accept, 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. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String communityName, + String transitHubName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, communityName, transitHubName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), 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 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) { + return this.beginDeleteAsync(resourceGroupName, communityName, transitHubName).getSyncPoller(); + } + + /** + * 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) { + return this.beginDeleteAsync(resourceGroupName, communityName, transitHubName, context).getSyncPoller(); + } + + /** + * 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. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String communityName, String transitHubName, + Context context) { + return beginDeleteAsync(resourceGroupName, communityName, transitHubName, context).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) { + deleteAsync(resourceGroupName, communityName, transitHubName).block(); + } + + /** + * 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) { + deleteAsync(resourceGroupName, communityName, transitHubName, context).block(); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCommunityResourceNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/TransitHubsImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/TransitHubsImpl.java new file mode 100644 index 000000000000..13bbb3bfd3b6 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/TransitHubsImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.TransitHubsClient; +import com.azure.resourcemanager.mission.fluent.models.TransitHubResourceInner; +import com.azure.resourcemanager.mission.models.TransitHubResource; +import com.azure.resourcemanager.mission.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.mission.MissionManager serviceManager; + + public TransitHubsImpl(TransitHubsClient innerClient, + com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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 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.mission.MissionManager manager() { + return this.serviceManager; + } + + public TransitHubResourceImpl define(String name) { + return new TransitHubResourceImpl(name, this.manager()); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/VirtualEnclavesClientImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/VirtualEnclavesClientImpl.java new file mode 100644 index 000000000000..a420c41fddeb --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/VirtualEnclavesClientImpl.java @@ -0,0 +1,1797 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.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.mission.fluent.VirtualEnclavesClient; +import com.azure.resourcemanager.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.EnclaveResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.EnclaveResourceListResult; +import com.azure.resourcemanager.mission.models.VirtualEnclavePatchResource; +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 MissionClientImpl client; + + /** + * Initializes an instance of VirtualEnclavesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualEnclavesClientImpl(MissionClientImpl client) { + this.service + = RestProxy.create(VirtualEnclavesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MissionClientVirtualEnclaves to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MissionClientVirtual") + public interface VirtualEnclavesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/virtualEnclaves") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") 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/{virtualEnclaveName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") 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" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @BodyParam("application/json") EnclaveResourceInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @BodyParam("application/json") VirtualEnclavePatchResource properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") 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" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/approvalCallback") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> approvalCallback(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @BodyParam("application/json") ApprovalCallbackRequest body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/approvalDeletionCallback") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> approvalDeletionCallback(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, + @BodyParam("application/json") ApprovalDeletionCallbackRequest body, @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("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context 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() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + 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. + * + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * 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<>(listAsync(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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, 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 ManagementException thrown 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<>(listByResourceGroupAsync(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 ManagementException thrown 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<>(listByResourceGroupAsync(resourceGroupName, 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(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 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) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualEnclaveName, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, resource, accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, EnclaveResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, resource, accept, 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. + * @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 PollerFlux} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnclaveResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String virtualEnclaveName, EnclaveResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, virtualEnclaveName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + 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 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, resource).getSyncPoller(); + } + + /** + * 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, resource, context).getSyncPoller(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String virtualEnclaveName, + EnclaveResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, resource, context).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 createOrUpdateAsync(resourceGroupName, virtualEnclaveName, resource).block(); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, virtualEnclaveName, resource, context).block(); + } + + /** + * 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, VirtualEnclavePatchResource properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, properties, accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, VirtualEnclavePatchResource properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, virtualEnclaveName, properties, accept, 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, VirtualEnclavePatchResource 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. + * @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 PollerFlux} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, EnclaveResourceInner> beginUpdateAsync( + String resourceGroupName, String virtualEnclaveName, VirtualEnclavePatchResource properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, virtualEnclaveName, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + 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 the {@link SyncPoller} for polling of virtual Enclave Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, EnclaveResourceInner> beginUpdate(String resourceGroupName, + String virtualEnclaveName, VirtualEnclavePatchResource properties) { + return this.beginUpdateAsync(resourceGroupName, virtualEnclaveName, properties).getSyncPoller(); + } + + /** + * 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, VirtualEnclavePatchResource properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, virtualEnclaveName, properties, context).getSyncPoller(); + } + + /** + * 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, + VirtualEnclavePatchResource 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String virtualEnclaveName, + VirtualEnclavePatchResource properties, Context context) { + return beginUpdateAsync(resourceGroupName, virtualEnclaveName, properties, context).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, + VirtualEnclavePatchResource properties) { + return updateAsync(resourceGroupName, virtualEnclaveName, properties).block(); + } + + /** + * 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, + VirtualEnclavePatchResource properties, Context context) { + return updateAsync(resourceGroupName, virtualEnclaveName, properties, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, accept, 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. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, virtualEnclaveName, accept, 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. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String virtualEnclaveName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, virtualEnclaveName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String virtualEnclaveName) { + return this.beginDeleteAsync(resourceGroupName, virtualEnclaveName).getSyncPoller(); + } + + /** + * 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) { + return this.beginDeleteAsync(resourceGroupName, virtualEnclaveName, context).getSyncPoller(); + } + + /** + * 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. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String virtualEnclaveName, Context context) { + return beginDeleteAsync(resourceGroupName, virtualEnclaveName, context).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) { + deleteAsync(resourceGroupName, virtualEnclaveName).block(); + } + + /** + * 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) { + deleteAsync(resourceGroupName, virtualEnclaveName, context).block(); + } + + /** + * 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 response body after handling of approvalCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalCallbackWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalCallbackRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.approvalCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, body, accept, 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. + * @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 body after handling of approvalCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalCallbackWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalCallbackRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.approvalCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, body, accept, 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalCallbackResponseInner> + beginApprovalCallbackAsync(String resourceGroupName, String virtualEnclaveName, ApprovalCallbackRequest body) { + Mono>> mono + = approvalCallbackWithResponseAsync(resourceGroupName, virtualEnclaveName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalCallbackResponseInner.class, ApprovalCallbackResponseInner.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. + * @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 PollerFlux} for polling of response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalCallbackResponseInner> + beginApprovalCallbackAsync(String resourceGroupName, String virtualEnclaveName, ApprovalCallbackRequest body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = approvalCallbackWithResponseAsync(resourceGroupName, virtualEnclaveName, body, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ApprovalCallbackResponseInner.class, ApprovalCallbackResponseInner.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 {@link SyncPoller} for polling of response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalCallbackResponseInner> + beginApprovalCallback(String resourceGroupName, String virtualEnclaveName, ApprovalCallbackRequest body) { + return this.beginApprovalCallbackAsync(resourceGroupName, virtualEnclaveName, body).getSyncPoller(); + } + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalCallbackResponseInner> beginApprovalCallback( + String resourceGroupName, String virtualEnclaveName, ApprovalCallbackRequest body, Context context) { + return this.beginApprovalCallbackAsync(resourceGroupName, virtualEnclaveName, body, context).getSyncPoller(); + } + + /** + * 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 response body after handling of approvalCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalCallbackAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalCallbackRequest body) { + return beginApprovalCallbackAsync(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. + * @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 body after handling of approvalCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalCallbackAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalCallbackRequest body, Context context) { + return beginApprovalCallbackAsync(resourceGroupName, virtualEnclaveName, body, context).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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalCallbackResponseInner approvalCallback(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body) { + return approvalCallbackAsync(resourceGroupName, virtualEnclaveName, body).block(); + } + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalCallbackResponseInner approvalCallback(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body, Context context) { + return approvalCallbackAsync(resourceGroupName, virtualEnclaveName, body, context).block(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalDeletionCallbackWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalDeletionCallbackRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.approvalDeletionCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, body, accept, 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. + * @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 body after handling of approvalDeletionCallbackRequest along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> approvalDeletionCallbackWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalDeletionCallbackRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.approvalDeletionCallback(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, body, accept, 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallbackAsync(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body) { + Mono>> mono + = approvalDeletionCallbackWithResponseAsync(resourceGroupName, virtualEnclaveName, body); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), ApprovalDeletionCallbackResponseInner.class, + ApprovalDeletionCallbackResponseInner.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. + * @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 PollerFlux} for polling of response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallbackAsync(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = approvalDeletionCallbackWithResponseAsync(resourceGroupName, virtualEnclaveName, body, context); + return this.client.getLroResult( + mono, this.client.getHttpPipeline(), ApprovalDeletionCallbackResponseInner.class, + ApprovalDeletionCallbackResponseInner.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 {@link SyncPoller} for polling of response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body) { + return this.beginApprovalDeletionCallbackAsync(resourceGroupName, virtualEnclaveName, body).getSyncPoller(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApprovalDeletionCallbackResponseInner> + beginApprovalDeletionCallback(String resourceGroupName, String virtualEnclaveName, + ApprovalDeletionCallbackRequest body, Context context) { + return this.beginApprovalDeletionCallbackAsync(resourceGroupName, virtualEnclaveName, body, context) + .getSyncPoller(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalDeletionCallbackAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalDeletionCallbackRequest body) { + return beginApprovalDeletionCallbackAsync(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. + * @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 body after handling of approvalDeletionCallbackRequest on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono approvalDeletionCallbackAsync(String resourceGroupName, + String virtualEnclaveName, ApprovalDeletionCallbackRequest body, Context context) { + return beginApprovalDeletionCallbackAsync(resourceGroupName, virtualEnclaveName, body, context).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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, + String virtualEnclaveName, ApprovalDeletionCallbackRequest body) { + return approvalDeletionCallbackAsync(resourceGroupName, virtualEnclaveName, body).block(); + } + + /** + * 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 response body after handling of approvalDeletionCallbackRequest. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApprovalDeletionCallbackResponseInner approvalDeletionCallback(String resourceGroupName, + String virtualEnclaveName, ApprovalDeletionCallbackRequest body, Context context) { + return approvalDeletionCallbackAsync(resourceGroupName, virtualEnclaveName, body, context).block(); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/VirtualEnclavesImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/VirtualEnclavesImpl.java new file mode 100644 index 000000000000..20ccd41df863 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/VirtualEnclavesImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.VirtualEnclavesClient; +import com.azure.resourcemanager.mission.fluent.models.ApprovalCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; +import com.azure.resourcemanager.mission.fluent.models.EnclaveResourceInner; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackResponse; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackResponse; +import com.azure.resourcemanager.mission.models.EnclaveResource; +import com.azure.resourcemanager.mission.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.mission.MissionManager serviceManager; + + public VirtualEnclavesImpl(VirtualEnclavesClient innerClient, + com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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 ApprovalCallbackResponse approvalCallback(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body) { + ApprovalCallbackResponseInner inner + = this.serviceClient().approvalCallback(resourceGroupName, virtualEnclaveName, body); + if (inner != null) { + return new ApprovalCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalCallbackResponse approvalCallback(String resourceGroupName, String virtualEnclaveName, + ApprovalCallbackRequest body, Context context) { + ApprovalCallbackResponseInner inner + = this.serviceClient().approvalCallback(resourceGroupName, virtualEnclaveName, body, context); + if (inner != null) { + return new ApprovalCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(String resourceGroupName, + String virtualEnclaveName, ApprovalDeletionCallbackRequest body) { + ApprovalDeletionCallbackResponseInner inner + = this.serviceClient().approvalDeletionCallback(resourceGroupName, virtualEnclaveName, body); + if (inner != null) { + return new ApprovalDeletionCallbackResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public ApprovalDeletionCallbackResponse approvalDeletionCallback(String resourceGroupName, + String virtualEnclaveName, ApprovalDeletionCallbackRequest body, Context context) { + ApprovalDeletionCallbackResponseInner inner + = this.serviceClient().approvalDeletionCallback(resourceGroupName, virtualEnclaveName, body, context); + if (inner != null) { + return new ApprovalDeletionCallbackResponseImpl(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.mission.MissionManager manager() { + return this.serviceManager; + } + + public EnclaveResourceImpl define(String name) { + return new EnclaveResourceImpl(name, this.manager()); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/WorkloadResourceImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/WorkloadResourceImpl.java new file mode 100644 index 000000000000..85fbc3919da0 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/WorkloadResourceImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.WorkloadResourceInner; +import com.azure.resourcemanager.mission.models.ProvisioningState; +import com.azure.resourcemanager.mission.models.UpdateWorkloadPatchProperties; +import com.azure.resourcemanager.mission.models.WorkloadPatchResource; +import com.azure.resourcemanager.mission.models.WorkloadResource; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class WorkloadResourceImpl + implements WorkloadResource, WorkloadResource.Definition, WorkloadResource.Update { + private WorkloadResourceInner innerObject; + + private final com.azure.resourcemanager.mission.MissionManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List resourceGroupCollection() { + List inner = this.innerModel().resourceGroupCollection(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + 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.mission.MissionManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualEnclaveName; + + private String workloadName; + + private WorkloadPatchResource 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.mission.MissionManager serviceManager) { + this.innerObject = new WorkloadResourceInner(); + this.serviceManager = serviceManager; + this.workloadName = name; + } + + public WorkloadResourceImpl update() { + this.updateProperties = new WorkloadPatchResource(); + 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.mission.MissionManager 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 withResourceGroupCollection(List resourceGroupCollection) { + this.innerModel().withResourceGroupCollection(resourceGroupCollection); + return this; + } + + public WorkloadResourceImpl withProperties(UpdateWorkloadPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/WorkloadsClientImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/WorkloadsClientImpl.java new file mode 100644 index 000000000000..7e8db43cecad --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/WorkloadsClientImpl.java @@ -0,0 +1,1406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.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.mission.fluent.WorkloadsClient; +import com.azure.resourcemanager.mission.fluent.models.WorkloadResourceInner; +import com.azure.resourcemanager.mission.models.WorkloadPatchResource; +import com.azure.resourcemanager.mission.models.WorkloadResourceListResult; +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 MissionClientImpl client; + + /** + * Initializes an instance of WorkloadsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkloadsClientImpl(MissionClientImpl client) { + this.service + = RestProxy.create(WorkloadsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MissionClientWorkloads to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MissionClientWorkloa") + public interface WorkloadsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("$host") 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}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByEnclaveResource(@HostParam("$host") 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/{workloadName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") 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" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads/{workloadName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @PathParam("workloadName") String workloadName, + @BodyParam("application/json") WorkloadResourceInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Mission/virtualEnclaves/{virtualEnclaveName}/workloads/{workloadName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualEnclaveName") String virtualEnclaveName, @PathParam("workloadName") String workloadName, + @BodyParam("application/json") WorkloadPatchResource properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "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("$host") 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("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @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("$host") String endpoint, + @HeaderParam("Accept") String accept, 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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync(String virtualEnclaveName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync(String virtualEnclaveName, Context context) { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(virtualEnclaveName, context), + nextLink -> listBySubscriptionNextSinglePageAsync(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 as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(String virtualEnclaveName) { + return new PagedIterable<>(listBySubscriptionAsync(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 ManagementException thrown 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<>(listBySubscriptionAsync(virtualEnclaveName, 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 ManagementException thrown 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByEnclaveResourceSinglePageAsync(String resourceGroupName, + String virtualEnclaveName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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. + * @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 PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByEnclaveResourceAsync(String resourceGroupName, + String virtualEnclaveName, Context context) { + return new PagedFlux<>( + () -> listByEnclaveResourceSinglePageAsync(resourceGroupName, virtualEnclaveName, context), + nextLink -> listByEnclaveResourceNextSinglePageAsync(nextLink, 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 ManagementException thrown 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<>(listByEnclaveResourceAsync(resourceGroupName, 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 ManagementException thrown 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<>(listByEnclaveResourceAsync(resourceGroupName, virtualEnclaveName, 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (workloadName == null) { + return Mono.error(new IllegalArgumentException("Parameter workloadName is required and cannot be null.")); + } + 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String workloadName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (workloadName == null) { + return Mono.error(new IllegalArgumentException("Parameter workloadName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(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 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) { + return getWithResponseAsync(resourceGroupName, virtualEnclaveName, workloadName, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (workloadName == null) { + return Mono.error(new IllegalArgumentException("Parameter workloadName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, resource, accept, + 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String workloadName, WorkloadResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (workloadName == null) { + return Mono.error(new IllegalArgumentException("Parameter workloadName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, resource, accept, + 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. + * @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 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, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, virtualEnclaveName, workloadName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, workloadName, resource) + .getSyncPoller(); + } + + /** + * 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) { + return this.beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, workloadName, resource, context) + .getSyncPoller(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String virtualEnclaveName, + String workloadName, WorkloadResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualEnclaveName, workloadName, resource, context).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 createOrUpdateAsync(resourceGroupName, virtualEnclaveName, workloadName, resource).block(); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, virtualEnclaveName, workloadName, resource, context).block(); + } + + /** + * 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, WorkloadPatchResource properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (workloadName == null) { + return Mono.error(new IllegalArgumentException("Parameter workloadName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, properties, + accept, 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. + * @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} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String workloadName, WorkloadPatchResource properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (workloadName == null) { + return Mono.error(new IllegalArgumentException("Parameter workloadName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, virtualEnclaveName, workloadName, properties, accept, 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, WorkloadPatchResource 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. + * @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 PollerFlux} for polling of workload Model Resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkloadResourceInner> beginUpdateAsync( + String resourceGroupName, String virtualEnclaveName, String workloadName, WorkloadPatchResource properties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, virtualEnclaveName, workloadName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), 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 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, WorkloadPatchResource properties) { + return this.beginUpdateAsync(resourceGroupName, virtualEnclaveName, workloadName, properties).getSyncPoller(); + } + + /** + * 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, WorkloadPatchResource properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, virtualEnclaveName, workloadName, properties, context) + .getSyncPoller(); + } + + /** + * 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, WorkloadPatchResource 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String virtualEnclaveName, + String workloadName, WorkloadPatchResource properties, Context context) { + return beginUpdateAsync(resourceGroupName, virtualEnclaveName, workloadName, properties, context).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, + WorkloadPatchResource properties) { + return updateAsync(resourceGroupName, virtualEnclaveName, workloadName, properties).block(); + } + + /** + * 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, + WorkloadPatchResource properties, Context context) { + return updateAsync(resourceGroupName, virtualEnclaveName, workloadName, properties, context).block(); + } + + /** + * 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) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (workloadName == null) { + return Mono.error(new IllegalArgumentException("Parameter workloadName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualEnclaveName, workloadName, accept, 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. + * @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 Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String virtualEnclaveName, String workloadName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualEnclaveName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualEnclaveName is required and cannot be null.")); + } + if (workloadName == null) { + return Mono.error(new IllegalArgumentException("Parameter workloadName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, virtualEnclaveName, workloadName, accept, 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. + * @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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String virtualEnclaveName, + String workloadName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, virtualEnclaveName, workloadName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), 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 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) { + return this.beginDeleteAsync(resourceGroupName, virtualEnclaveName, workloadName).getSyncPoller(); + } + + /** + * 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) { + return this.beginDeleteAsync(resourceGroupName, virtualEnclaveName, workloadName, context).getSyncPoller(); + } + + /** + * 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. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String virtualEnclaveName, String workloadName, + Context context) { + return beginDeleteAsync(resourceGroupName, virtualEnclaveName, workloadName, context).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) { + deleteAsync(resourceGroupName, virtualEnclaveName, workloadName).block(); + } + + /** + * 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) { + deleteAsync(resourceGroupName, virtualEnclaveName, workloadName, context).block(); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } + + /** + * 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) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + 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. + * @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} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByEnclaveResourceNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return 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)); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/WorkloadsImpl.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/WorkloadsImpl.java new file mode 100644 index 000000000000..a3af8aba2f03 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/WorkloadsImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.WorkloadsClient; +import com.azure.resourcemanager.mission.fluent.models.WorkloadResourceInner; +import com.azure.resourcemanager.mission.models.WorkloadResource; +import com.azure.resourcemanager.mission.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.mission.MissionManager serviceManager; + + public WorkloadsImpl(WorkloadsClient innerClient, com.azure.resourcemanager.mission.MissionManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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 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.mission.MissionManager manager() { + return this.serviceManager; + } + + public WorkloadResourceImpl define(String name) { + return new WorkloadResourceImpl(name, this.manager()); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/package-info.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/implementation/package-info.java new file mode 100644 index 000000000000..c227abf3a972 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/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) AutoRest Code Generator. + +/** + * Package containing the implementations for MissionClient. + * Microsoft Mission Resource Provider management API. + */ +package com.azure.resourcemanager.mission.implementation; diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ActionPerformed.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ActionPerformed.java new file mode 100644 index 000000000000..22c9e6f2592b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ActionPerformed.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the action performed by the approver. + */ +public final class ActionPerformed extends ExpandableStringEnum { + /** + * Static value Approved for ActionPerformed. + */ + public static final ActionPerformed APPROVED = fromString("Approved"); + + /** + * Static value Rejected for ActionPerformed. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ActionType.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ActionType.java new file mode 100644 index 000000000000..f3cf640bcad8 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackRequest.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackRequest.java new file mode 100644 index 000000000000..2d9b466979ec --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackRequest.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceRequestAction() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resourceRequestAction in model ApprovalCallbackRequest")); + } + if (approvalStatus() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property approvalStatus in model ApprovalCallbackRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApprovalCallbackRequest.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackRequestApprovalStatus.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackRequestApprovalStatus.java new file mode 100644 index 000000000000..d0d0c22fe240 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackRequestApprovalStatus.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Approval status indicating 'Approved' or 'Rejected'. + */ +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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackRequestResourceRequestAction.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackRequestResourceRequestAction.java new file mode 100644 index 000000000000..386c440de75a --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackRequestResourceRequestAction.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Resource request action indicating action which needed to be performed upon calling approval-callback post action. + */ +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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackResponse.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackResponse.java new file mode 100644 index 000000000000..371fc057404b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalCallbackResponse.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.resourcemanager.mission.fluent.models.ApprovalCallbackResponseInner; + +/** + * An immutable client-side representation of ApprovalCallbackResponse. + */ +public interface ApprovalCallbackResponse { + /** + * Gets the message property: Confirmation message indicating the result of the operation. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.mission.fluent.models.ApprovalCallbackResponseInner object. + * + * @return the inner object. + */ + ApprovalCallbackResponseInner innerModel(); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalDeletionCallbackRequest.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalDeletionCallbackRequest.java new file mode 100644 index 000000000000..67dcb4c86684 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalDeletionCallbackRequest.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceRequestAction() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property resourceRequestAction in model ApprovalDeletionCallbackRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApprovalDeletionCallbackRequest.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalDeletionCallbackRequestResourceRequestAction.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalDeletionCallbackRequestResourceRequestAction.java new file mode 100644 index 000000000000..e7ca22d03a7f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalDeletionCallbackRequestResourceRequestAction.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Resource request action indicating action which needed to be performed upon calling approval-deletion-callback post + * action. + */ +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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalDeletionCallbackResponse.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalDeletionCallbackResponse.java new file mode 100644 index 000000000000..421f9cac7aab --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalDeletionCallbackResponse.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner; + +/** + * An immutable client-side representation of ApprovalDeletionCallbackResponse. + */ +public interface ApprovalDeletionCallbackResponse { + /** + * Gets the message property: Confirmation message indicating the result of the operation. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.mission.fluent.models.ApprovalDeletionCallbackResponseInner object. + * + * @return the inner object. + */ + ApprovalDeletionCallbackResponseInner innerModel(); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalPatchResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalPatchResource.java new file mode 100644 index 000000000000..a8694de04707 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalPatchResource.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 properties for patching. + */ +@Fluent +public final class ApprovalPatchResource implements JsonSerializable { + /* + * Approval Patch properties + */ + private UpdateApprovalProperties properties; + + /** + * Creates an instance of ApprovalPatchResource class. + */ + public ApprovalPatchResource() { + } + + /** + * Get the properties property: Approval Patch properties. + * + * @return the properties value. + */ + public UpdateApprovalProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Approval Patch properties. + * + * @param properties the properties value to set. + * @return the ApprovalPatchResource object itself. + */ + public ApprovalPatchResource withProperties(UpdateApprovalProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ApprovalPatchResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ApprovalPatchResource 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 ApprovalPatchResource. + */ + public static ApprovalPatchResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ApprovalPatchResource deserializedApprovalPatchResource = new ApprovalPatchResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedApprovalPatchResource.properties = UpdateApprovalProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedApprovalPatchResource; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalPolicy.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalPolicy.java new file mode 100644 index 000000000000..31b9ad134fc3 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalPolicy.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Approval Policy. + */ +public final class ApprovalPolicy extends ExpandableStringEnum { + /** + * Static value Required for ApprovalPolicy. + */ + public static final ApprovalPolicy REQUIRED = fromString("Required"); + + /** + * Static value NotRequired for ApprovalPolicy. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalResource.java new file mode 100644 index 000000000000..4e3285437e9b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalResource.java @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.ApprovalResourceInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the parent1 property: Parameter for optimizing query results. + * + * @return the parent1 value. + */ + String parent1(); + + /** + * Gets the parent2 property: Parameter for optimizing query results. + * + * @return the parent2 value. + */ + String parent2(); + + /** + * Gets the requestMetadata property: Request metadata for the approval request. + * + * @return the requestMetadata value. + */ + RequestMetadata requestMetadata(); + + /** + * Gets the approvers property: List of approvers for the approval request. + * + * @return the approvers value. + */ + List approvers(); + + /** + * Gets the ticketId property: Ticket ID for the approval request. + * + * @return the ticketId value. + */ + String ticketId(); + + /** + * Gets the createdAt property: Approval request creation time. + * + * @return the createdAt value. + */ + OffsetDateTime createdAt(); + + /** + * Gets 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. + */ + OffsetDateTime stateChangedAt(); + + /** + * Gets the inner com.azure.resourcemanager.mission.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.WithParent1, DefinitionStages.WithParent2, + DefinitionStages.WithRequestMetadata, DefinitionStages.WithApprovers, DefinitionStages.WithTicketId, + DefinitionStages.WithCreatedAt, DefinitionStages.WithStateChangedAt { + /** + * 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 parent1. + */ + interface WithParent1 { + /** + * Specifies the parent1 property: Parameter for optimizing query results. + * + * @param parent1 Parameter for optimizing query results. + * @return the next definition stage. + */ + WithCreate withParent1(String parent1); + } + + /** + * The stage of the ApprovalResource definition allowing to specify parent2. + */ + interface WithParent2 { + /** + * Specifies the parent2 property: Parameter for optimizing query results. + * + * @param parent2 Parameter for optimizing query results. + * @return the next definition stage. + */ + WithCreate withParent2(String parent2); + } + + /** + * The stage of the ApprovalResource definition allowing to specify requestMetadata. + */ + interface WithRequestMetadata { + /** + * Specifies the requestMetadata property: Request metadata for the approval request.. + * + * @param requestMetadata Request metadata for the approval request. + * @return the next definition stage. + */ + WithCreate withRequestMetadata(RequestMetadata requestMetadata); + } + + /** + * The stage of the ApprovalResource definition allowing to specify approvers. + */ + interface WithApprovers { + /** + * Specifies the approvers property: List of approvers for the approval request. + * + * @param approvers List of approvers for the approval request. + * @return the next definition stage. + */ + WithCreate withApprovers(List approvers); + } + + /** + * The stage of the ApprovalResource definition allowing to specify ticketId. + */ + interface WithTicketId { + /** + * Specifies the ticketId property: Ticket ID for the approval request. + * + * @param ticketId Ticket ID for the approval request. + * @return the next definition stage. + */ + WithCreate withTicketId(String ticketId); + } + + /** + * The stage of the ApprovalResource definition allowing to specify createdAt. + */ + interface WithCreatedAt { + /** + * Specifies the createdAt property: Approval request creation time. + * + * @param createdAt Approval request creation time. + * @return the next definition stage. + */ + WithCreate withCreatedAt(OffsetDateTime createdAt); + } + + /** + * The stage of the ApprovalResource definition allowing to specify stateChangedAt. + */ + interface WithStateChangedAt { + /** + * Specifies the stateChangedAt property: Approval request state change time, time at which approval request + * state changed from pending to approved or rejected.. + * + * @param stateChangedAt Approval request state change time, time at which approval request state changed + * from pending to approved or rejected. + * @return the next definition stage. + */ + WithCreate withStateChangedAt(OffsetDateTime stateChangedAt); + } + } + + /** + * 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(UpdateApprovalProperties 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 response body after handling of approvalCallbackRequest. + */ + InitiatorCallbackResponse initiatorCallback(InitiatorCallbackRequest 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 response body after handling of approvalCallbackRequest. + */ + InitiatorCallbackResponse initiatorCallback(InitiatorCallbackRequest body, Context context); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalResourceListResult.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalResourceListResult.java new file mode 100644 index 000000000000..f1170cecc6a4 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalResourceListResult.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.fluent.models.ApprovalResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a ApprovalResource list operation. + */ +@Fluent +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. + */ + public ApprovalResourceListResult() { + } + + /** + * Get the value property: The ApprovalResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The ApprovalResource items on this page. + * + * @param value the value value to set. + * @return the ApprovalResourceListResult object itself. + */ + public ApprovalResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the ApprovalResourceListResult object itself. + */ + public ApprovalResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model ApprovalResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ApprovalResourceListResult.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalSettings.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalSettings.java new file mode 100644 index 000000000000..3f8656f510e9 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalSettings.java @@ -0,0 +1,545 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + + /* + * Behavior of enclave connection update workflow after endpoint update is approved (Automatic or Manual). + */ + private ApprovalSettingsConnectionUpdateMode connectionUpdateMode; + + /* + * 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 connectionUpdateMode property: Behavior of enclave connection update workflow after endpoint update is + * approved (Automatic or Manual). + * + * @return the connectionUpdateMode value. + */ + public ApprovalSettingsConnectionUpdateMode connectionUpdateMode() { + return this.connectionUpdateMode; + } + + /** + * Set the connectionUpdateMode property: Behavior of enclave connection update workflow after endpoint update is + * approved (Automatic or Manual). + * + * @param connectionUpdateMode the connectionUpdateMode value to set. + * @return the ApprovalSettings object itself. + */ + public ApprovalSettings withConnectionUpdateMode(ApprovalSettingsConnectionUpdateMode connectionUpdateMode) { + this.connectionUpdateMode = connectionUpdateMode; + 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (mandatoryApprovers() != null) { + mandatoryApprovers().forEach(e -> e.validate()); + } + } + + /** + * {@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("connectionUpdateMode", + this.connectionUpdateMode == null ? null : this.connectionUpdateMode.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 ("connectionUpdateMode".equals(fieldName)) { + deserializedApprovalSettings.connectionUpdateMode + = ApprovalSettingsConnectionUpdateMode.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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalSettingsConnectionUpdateMode.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalSettingsConnectionUpdateMode.java new file mode 100644 index 000000000000..bbaa989f777a --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalSettingsConnectionUpdateMode.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Behavior of enclave connection update workflow after endpoint update is approved (Automatic or Manual). + */ +public final class ApprovalSettingsConnectionUpdateMode + extends ExpandableStringEnum { + /** + * Static value Automatic for ApprovalSettingsConnectionUpdateMode. + */ + public static final ApprovalSettingsConnectionUpdateMode AUTOMATIC = fromString("Automatic"); + + /** + * Static value Manual for ApprovalSettingsConnectionUpdateMode. + */ + public static final ApprovalSettingsConnectionUpdateMode MANUAL = fromString("Manual"); + + /** + * Creates a new instance of ApprovalSettingsConnectionUpdateMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ApprovalSettingsConnectionUpdateMode() { + } + + /** + * Creates or finds a ApprovalSettingsConnectionUpdateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApprovalSettingsConnectionUpdateMode. + */ + public static ApprovalSettingsConnectionUpdateMode fromString(String name) { + return fromString(name, ApprovalSettingsConnectionUpdateMode.class); + } + + /** + * Gets known ApprovalSettingsConnectionUpdateMode values. + * + * @return known ApprovalSettingsConnectionUpdateMode values. + */ + public static Collection values() { + return values(ApprovalSettingsConnectionUpdateMode.class); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalStatus.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalStatus.java new file mode 100644 index 000000000000..73862bda845f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ApprovalStatus.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Approval Status Enum. + */ +public final class ApprovalStatus extends ExpandableStringEnum { + /** + * Static value Approved for ApprovalStatus. + */ + public static final ApprovalStatus APPROVED = fromString("Approved"); + + /** + * Static value Rejected for ApprovalStatus. + */ + public static final ApprovalStatus REJECTED = fromString("Rejected"); + + /** + * Static value Pending for ApprovalStatus. + */ + public static final ApprovalStatus PENDING = fromString("Pending"); + + /** + * Static value Deleted for ApprovalStatus. + */ + public static final ApprovalStatus DELETED = fromString("Deleted"); + + /** + * Static value Expired for ApprovalStatus. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Approvals.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Approvals.java new file mode 100644 index 000000000000..37b97f592f75 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Approvals.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /** + * 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); + + /** + * 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); + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + InitiatorCallbackResponse initiatorCallback(String resourceUri, String approvalName, InitiatorCallbackRequest 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 response body after handling of approvalCallbackRequest. + */ + InitiatorCallbackResponse initiatorCallback(String resourceUri, String approvalName, InitiatorCallbackRequest 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Approver.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Approver.java new file mode 100644 index 000000000000..b726eb574a9d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Approver.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +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 { + /* + * EntraId 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: 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 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (approverEntraId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property approverEntraId in model Approver")); + } + if (actionPerformed() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property actionPerformed in model Approver")); + } + if (lastUpdatedAt() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property lastUpdatedAt in model Approver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Approver.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("approverEntraId", this.approverEntraId); + jsonWriter.writeStringField("actionPerformed", + this.actionPerformed == null ? null : this.actionPerformed.toString()); + jsonWriter.writeStringField("lastUpdatedAt", + this.lastUpdatedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdatedAt)); + 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 ("actionPerformed".equals(fieldName)) { + deserializedApprover.actionPerformed = ActionPerformed.fromString(reader.getString()); + } else if ("lastUpdatedAt".equals(fieldName)) { + deserializedApprover.lastUpdatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedApprover; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/AzureResourceManagerCommonTypesManagedServiceIdentityUpdate.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/AzureResourceManagerCommonTypesManagedServiceIdentityUpdate.java new file mode 100644 index 000000000000..78f3f66ebe37 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/AzureResourceManagerCommonTypesManagedServiceIdentityUpdate.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 AzureResourceManagerCommonTypesManagedServiceIdentityUpdate + implements JsonSerializable { + /* + * 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 AzureResourceManagerCommonTypesManagedServiceIdentityUpdate class. + */ + public AzureResourceManagerCommonTypesManagedServiceIdentityUpdate() { + } + + /** + * 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 AzureResourceManagerCommonTypesManagedServiceIdentityUpdate object itself. + */ + public AzureResourceManagerCommonTypesManagedServiceIdentityUpdate 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 AzureResourceManagerCommonTypesManagedServiceIdentityUpdate object itself. + */ + public AzureResourceManagerCommonTypesManagedServiceIdentityUpdate + withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + /** + * {@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 AzureResourceManagerCommonTypesManagedServiceIdentityUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureResourceManagerCommonTypesManagedServiceIdentityUpdate 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 + * AzureResourceManagerCommonTypesManagedServiceIdentityUpdate. + */ + public static AzureResourceManagerCommonTypesManagedServiceIdentityUpdate fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + AzureResourceManagerCommonTypesManagedServiceIdentityUpdate deserializedAzureResourceManagerCommonTypesManagedServiceIdentityUpdate + = new AzureResourceManagerCommonTypesManagedServiceIdentityUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedAzureResourceManagerCommonTypesManagedServiceIdentityUpdate.type + = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> ManagedServiceIdentityUserAssignedIdentities.fromJson(reader1)); + deserializedAzureResourceManagerCommonTypesManagedServiceIdentityUpdate.userAssignedIdentities + = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedAzureResourceManagerCommonTypesManagedServiceIdentityUpdate; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CheckAddressSpaceAvailabilityRequest.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CheckAddressSpaceAvailabilityRequest.java new file mode 100644 index 000000000000..db6c1c8a67ab --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CheckAddressSpaceAvailabilityRequest.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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 EnclaveVirtualNetwork 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 EnclaveVirtualNetwork 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(EnclaveVirtualNetwork enclaveVirtualNetwork) { + this.enclaveVirtualNetwork = enclaveVirtualNetwork; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (communityResourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property communityResourceId in model CheckAddressSpaceAvailabilityRequest")); + } + if (enclaveVirtualNetwork() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property enclaveVirtualNetwork in model CheckAddressSpaceAvailabilityRequest")); + } else { + enclaveVirtualNetwork().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CheckAddressSpaceAvailabilityRequest.class); + + /** + * {@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 + = EnclaveVirtualNetwork.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckAddressSpaceAvailabilityRequest; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CheckAddressSpaceAvailabilityResponse.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CheckAddressSpaceAvailabilityResponse.java new file mode 100644 index 000000000000..709a5603b447 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CheckAddressSpaceAvailabilityResponse.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.resourcemanager.mission.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.mission.fluent.models.CheckAddressSpaceAvailabilityResponseInner object. + * + * @return the inner object. + */ + CheckAddressSpaceAvailabilityResponseInner innerModel(); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Communities.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Communities.java new file mode 100644 index 000000000000..f3cad890f272 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Communities.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointDestinationRule.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointDestinationRule.java new file mode 100644 index 000000000000..5a2470e25524 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointDestinationRule.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /* + * Endpoint Rule Name. + */ + private String name; + + /* + * 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 port; + + /* + * Destination Type. + */ + private DestinationType destinationType; + + /* + * Protocols. Options specified by Endpoint Protocol Enum. + */ + private List protocols; + + /* + * Transit Hub Resource Id. + */ + private String transitHubResourceId; + + /** + * Creates an instance of CommunityEndpointDestinationRule class. + */ + public CommunityEndpointDestinationRule() { + } + + /** + * Get the name property: Endpoint Rule Name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Endpoint Rule Name. + * + * @param name the name value to set. + * @return the CommunityEndpointDestinationRule object itself. + */ + public CommunityEndpointDestinationRule withName(String name) { + this.name = name; + 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 port property: Port. Can include multiple ports separated by commas or a range indicated by a hyphen. + * + * @return the port value. + */ + public String port() { + return this.port; + } + + /** + * Set the port property: Port. Can include multiple ports separated by commas or a range indicated by a hyphen. + * + * @param port the port value to set. + * @return the CommunityEndpointDestinationRule object itself. + */ + public CommunityEndpointDestinationRule withPort(String port) { + this.port = port; + return this; + } + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("destination", this.destination); + jsonWriter.writeStringField("port", this.port); + 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); + 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 ("name".equals(fieldName)) { + deserializedCommunityEndpointDestinationRule.name = reader.getString(); + } else if ("destination".equals(fieldName)) { + deserializedCommunityEndpointDestinationRule.destination = reader.getString(); + } else if ("port".equals(fieldName)) { + deserializedCommunityEndpointDestinationRule.port = reader.getString(); + } else 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 { + reader.skipChildren(); + } + } + + return deserializedCommunityEndpointDestinationRule; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointPatchResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointPatchResource.java new file mode 100644 index 000000000000..1c503cff326d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointPatchResource.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 CommunityEndpointPatchResource implements JsonSerializable { + /* + * Community Endpoint Patch properties + */ + private UpdateCommunityEndpointPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of CommunityEndpointPatchResource class. + */ + public CommunityEndpointPatchResource() { + } + + /** + * Get the properties property: Community Endpoint Patch properties. + * + * @return the properties value. + */ + public UpdateCommunityEndpointPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Community Endpoint Patch properties. + * + * @param properties the properties value to set. + * @return the CommunityEndpointPatchResource object itself. + */ + public CommunityEndpointPatchResource withProperties(UpdateCommunityEndpointPatchProperties 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 CommunityEndpointPatchResource object itself. + */ + public CommunityEndpointPatchResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@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 CommunityEndpointPatchResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityEndpointPatchResource 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 CommunityEndpointPatchResource. + */ + public static CommunityEndpointPatchResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityEndpointPatchResource deserializedCommunityEndpointPatchResource + = new CommunityEndpointPatchResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedCommunityEndpointPatchResource.properties + = UpdateCommunityEndpointPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCommunityEndpointPatchResource.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityEndpointPatchResource; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointProtocol.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointProtocol.java new file mode 100644 index 000000000000..c338733fd179 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointProtocol.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Community Endpoint Protocol Enum. + */ +public final class CommunityEndpointProtocol extends ExpandableStringEnum { + /** + * Static value ANY for CommunityEndpointProtocol. + */ + public static final CommunityEndpointProtocol ANY = fromString("ANY"); + + /** + * Static value TCP for CommunityEndpointProtocol. + */ + public static final CommunityEndpointProtocol TCP = fromString("TCP"); + + /** + * Static value UDP for CommunityEndpointProtocol. + */ + public static final CommunityEndpointProtocol UDP = fromString("UDP"); + + /** + * Static value ICMP for CommunityEndpointProtocol. + */ + public static final CommunityEndpointProtocol ICMP = fromString("ICMP"); + + /** + * Static value ESP for CommunityEndpointProtocol. + */ + public static final CommunityEndpointProtocol ESP = fromString("ESP"); + + /** + * Static value AH for CommunityEndpointProtocol. + */ + public static final CommunityEndpointProtocol AH = fromString("AH"); + + /** + * Static value HTTPS for CommunityEndpointProtocol. + */ + public static final CommunityEndpointProtocol HTTPS = fromString("HTTPS"); + + /** + * Static value HTTP for CommunityEndpointProtocol. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointResource.java new file mode 100644 index 000000000000..1277478d561e --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointResource.java @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.CommunityEndpointResourceInner; +import java.util.List; +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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the ruleCollection property: Community Endpoint Rule Collection. + * + * @return the ruleCollection value. + */ + List ruleCollection(); + + /** + * Gets the resourceCollection property: List of resource ids created by community endpoint. + * + * @return the resourceCollection value. + */ + List resourceCollection(); + + /** + * Gets the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * 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.mission.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.WithRuleCollection, + DefinitionStages.WithResourceCollection { + /** + * 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 ruleCollection. + */ + interface WithRuleCollection { + /** + * Specifies the ruleCollection property: Community Endpoint Rule Collection.. + * + * @param ruleCollection Community Endpoint Rule Collection. + * @return the next definition stage. + */ + WithCreate withRuleCollection(List ruleCollection); + } + + /** + * The stage of the CommunityEndpointResource definition allowing to specify resourceCollection. + */ + interface WithResourceCollection { + /** + * Specifies the resourceCollection property: List of resource ids created by community endpoint.. + * + * @param resourceCollection List of resource ids created by community endpoint. + * @return the next definition stage. + */ + WithCreate withResourceCollection(List resourceCollection); + } + } + + /** + * 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(UpdateCommunityEndpointPatchProperties 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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointResourceListResult.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointResourceListResult.java new file mode 100644 index 000000000000..d95d735ed90c --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpointResourceListResult.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.fluent.models.CommunityEndpointResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a CommunityEndpointResource list operation. + */ +@Fluent +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. + */ + public CommunityEndpointResourceListResult() { + } + + /** + * Get the value property: The CommunityEndpointResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The CommunityEndpointResource items on this page. + * + * @param value the value value to set. + * @return the CommunityEndpointResourceListResult object itself. + */ + public CommunityEndpointResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CommunityEndpointResourceListResult object itself. + */ + public CommunityEndpointResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model CommunityEndpointResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CommunityEndpointResourceListResult.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpoints.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpoints.java new file mode 100644 index 000000000000..9bb9c68c8fee --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityEndpoints.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityPatchResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityPatchResource.java new file mode 100644 index 000000000000..8c4d20d6acc5 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityPatchResource.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 CommunityPatchResource implements JsonSerializable { + /* + * Community Patch properties + */ + private UpdateCommunityPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The managed service identities assigned to this resource. + */ + private AzureResourceManagerCommonTypesManagedServiceIdentityUpdate identity; + + /** + * Creates an instance of CommunityPatchResource class. + */ + public CommunityPatchResource() { + } + + /** + * Get the properties property: Community Patch properties. + * + * @return the properties value. + */ + public UpdateCommunityPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Community Patch properties. + * + * @param properties the properties value to set. + * @return the CommunityPatchResource object itself. + */ + public CommunityPatchResource withProperties(UpdateCommunityPatchProperties 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 CommunityPatchResource object itself. + */ + public CommunityPatchResource 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 AzureResourceManagerCommonTypesManagedServiceIdentityUpdate 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 CommunityPatchResource object itself. + */ + public CommunityPatchResource withIdentity(AzureResourceManagerCommonTypesManagedServiceIdentityUpdate identity) { + this.identity = identity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@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 CommunityPatchResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CommunityPatchResource 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 CommunityPatchResource. + */ + public static CommunityPatchResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CommunityPatchResource deserializedCommunityPatchResource = new CommunityPatchResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedCommunityPatchResource.properties = UpdateCommunityPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCommunityPatchResource.tags = tags; + } else if ("identity".equals(fieldName)) { + deserializedCommunityPatchResource.identity + = AzureResourceManagerCommonTypesManagedServiceIdentityUpdate.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCommunityPatchResource; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityResource.java new file mode 100644 index 000000000000..a77d4a73a8d5 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityResource.java @@ -0,0 +1,465 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.fluent.models.CommunityResourceInner; +import java.util.List; +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 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 addressSpace property: Address Space. + * + * @return the addressSpace value. + */ + String addressSpace(); + + /** + * Gets the dnsServers property: Dns Servers. + * + * @return the dnsServers value. + */ + List dnsServers(); + + /** + * Gets the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the resourceCollection property: List of resource ids created by communities. + * + * @return the resourceCollection value. + */ + List resourceCollection(); + + /** + * Gets the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @return the managedResourceGroupConfiguration value. + */ + ManagedResourceGroupConfiguration managedResourceGroupConfiguration(); + + /** + * Gets the governedServiceList property: List of services governed by a community. + * + * @return the governedServiceList value. + */ + List governedServiceList(); + + /** + * Gets the communityRoleAssignments property: Community role assignments. + * + * @return the communityRoleAssignments value. + */ + List communityRoleAssignments(); + + /** + * Gets the approvalSettings property: Approval requirements for various actions on the community's resources. + * + * @return the approvalSettings value. + */ + ApprovalSettings approvalSettings(); + + /** + * Gets the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @return the maintenanceModeConfiguration value. + */ + MaintenanceModeConfiguration maintenanceModeConfiguration(); + + /** + * 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.mission.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.WithIdentity, DefinitionStages.WithAddressSpace, + DefinitionStages.WithDnsServers, DefinitionStages.WithManagedResourceGroupConfiguration, + DefinitionStages.WithGovernedServiceList, DefinitionStages.WithCommunityRoleAssignments, + DefinitionStages.WithApprovalSettings, DefinitionStages.WithMaintenanceModeConfiguration { + /** + * 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 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); + } + + /** + * The stage of the CommunityResource definition allowing to specify addressSpace. + */ + interface WithAddressSpace { + /** + * Specifies the addressSpace property: Address Space.. + * + * @param addressSpace Address Space. + * @return the next definition stage. + */ + WithCreate withAddressSpace(String addressSpace); + } + + /** + * The stage of the CommunityResource definition allowing to specify dnsServers. + */ + interface WithDnsServers { + /** + * Specifies the dnsServers property: Dns Servers.. + * + * @param dnsServers Dns Servers. + * @return the next definition stage. + */ + WithCreate withDnsServers(List dnsServers); + } + + /** + * The stage of the CommunityResource definition allowing to specify managedResourceGroupConfiguration. + */ + interface WithManagedResourceGroupConfiguration { + /** + * Specifies the managedResourceGroupConfiguration property: Managed resource group configuration.. + * + * @param managedResourceGroupConfiguration Managed resource group configuration. + * @return the next definition stage. + */ + WithCreate withManagedResourceGroupConfiguration( + ManagedResourceGroupConfiguration managedResourceGroupConfiguration); + } + + /** + * The stage of the CommunityResource definition allowing to specify governedServiceList. + */ + interface WithGovernedServiceList { + /** + * Specifies the governedServiceList property: List of services governed by a community.. + * + * @param governedServiceList List of services governed by a community. + * @return the next definition stage. + */ + WithCreate withGovernedServiceList(List governedServiceList); + } + + /** + * The stage of the CommunityResource definition allowing to specify communityRoleAssignments. + */ + interface WithCommunityRoleAssignments { + /** + * Specifies the communityRoleAssignments property: Community role assignments. + * + * @param communityRoleAssignments Community role assignments. + * @return the next definition stage. + */ + WithCreate withCommunityRoleAssignments(List communityRoleAssignments); + } + + /** + * The stage of the CommunityResource definition allowing to specify approvalSettings. + */ + interface WithApprovalSettings { + /** + * Specifies the approvalSettings property: Approval requirements for various actions on the community's + * resources.. + * + * @param approvalSettings Approval requirements for various actions on the community's resources. + * @return the next definition stage. + */ + WithCreate withApprovalSettings(ApprovalSettings approvalSettings); + } + + /** + * The stage of the CommunityResource definition allowing to specify maintenanceModeConfiguration. + */ + interface WithMaintenanceModeConfiguration { + /** + * Specifies the maintenanceModeConfiguration property: Maintenance Mode configuration.. + * + * @param maintenanceModeConfiguration Maintenance Mode configuration. + * @return the next definition stage. + */ + WithCreate withMaintenanceModeConfiguration(MaintenanceModeConfiguration maintenanceModeConfiguration); + } + } + + /** + * 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(UpdateCommunityPatchProperties 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(AzureResourceManagerCommonTypesManagedServiceIdentityUpdate 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityResourceListResult.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityResourceListResult.java new file mode 100644 index 000000000000..188e6b6f33dc --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/CommunityResourceListResult.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.fluent.models.CommunityResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a CommunityResource list operation. + */ +@Fluent +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. + */ + public CommunityResourceListResult() { + } + + /** + * Get the value property: The CommunityResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The CommunityResource items on this page. + * + * @param value the value value to set. + * @return the CommunityResourceListResult object itself. + */ + public CommunityResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CommunityResourceListResult object itself. + */ + public CommunityResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model CommunityResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CommunityResourceListResult.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/DestinationType.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/DestinationType.java new file mode 100644 index 000000000000..2091ea33a6c9 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/DestinationType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Destination Type Enum. + */ +public final class DestinationType extends ExpandableStringEnum { + /** + * Static value FQDN for DestinationType. + */ + public static final DestinationType FQDN = fromString("FQDN"); + + /** + * Static value FQDNTag for DestinationType. + */ + public static final DestinationType FQDNTAG = fromString("FQDNTag"); + + /** + * Static value IPAddress for DestinationType. + */ + public static final DestinationType IPADDRESS = fromString("IPAddress"); + + /** + * Static value PrivateNetwork for DestinationType. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/DiagnosticDestination.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/DiagnosticDestination.java new file mode 100644 index 000000000000..ddf7839300f0 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/DiagnosticDestination.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /** + * Static value CommunityOnly for DiagnosticDestination. + */ + public static final DiagnosticDestination COMMUNITY_ONLY = fromString("CommunityOnly"); + + /** + * Static value EnclaveOnly for DiagnosticDestination. + */ + public static final DiagnosticDestination ENCLAVE_ONLY = fromString("EnclaveOnly"); + + /** + * Static value Both for DiagnosticDestination. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveAddressSpaces.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveAddressSpaces.java new file mode 100644 index 000000000000..cac04830e12a --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveAddressSpaces.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 Address Spaces. + */ +@Fluent +public final class EnclaveAddressSpaces implements JsonSerializable { + /* + * Enclave Address Space + */ + private String enclaveAddressSpace; + + /* + * Managed Address Space + */ + private String managedAddressSpace; + + /** + * Creates an instance of EnclaveAddressSpaces class. + */ + public EnclaveAddressSpaces() { + } + + /** + * Get the enclaveAddressSpace property: Enclave Address Space. + * + * @return the enclaveAddressSpace value. + */ + public String enclaveAddressSpace() { + return this.enclaveAddressSpace; + } + + /** + * Set the enclaveAddressSpace property: Enclave Address Space. + * + * @param enclaveAddressSpace the enclaveAddressSpace value to set. + * @return the EnclaveAddressSpaces object itself. + */ + public EnclaveAddressSpaces withEnclaveAddressSpace(String enclaveAddressSpace) { + this.enclaveAddressSpace = enclaveAddressSpace; + return this; + } + + /** + * Get the managedAddressSpace property: Managed Address Space. + * + * @return the managedAddressSpace value. + */ + public String managedAddressSpace() { + return this.managedAddressSpace; + } + + /** + * Set the managedAddressSpace property: Managed Address Space. + * + * @param managedAddressSpace the managedAddressSpace value to set. + * @return the EnclaveAddressSpaces object itself. + */ + public EnclaveAddressSpaces withManagedAddressSpace(String managedAddressSpace) { + this.managedAddressSpace = managedAddressSpace; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@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 EnclaveAddressSpaces from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveAddressSpaces 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 EnclaveAddressSpaces. + */ + public static EnclaveAddressSpaces fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveAddressSpaces deserializedEnclaveAddressSpaces = new EnclaveAddressSpaces(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enclaveAddressSpace".equals(fieldName)) { + deserializedEnclaveAddressSpaces.enclaveAddressSpace = reader.getString(); + } else if ("managedAddressSpace".equals(fieldName)) { + deserializedEnclaveAddressSpaces.managedAddressSpace = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveAddressSpaces; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionPatchResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionPatchResource.java new file mode 100644 index 000000000000..255344ab3180 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionPatchResource.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 EnclaveConnectionPatchResource implements JsonSerializable { + /* + * Enclave Connection Patch properties + */ + private UpdateEnclaveConnectionPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of EnclaveConnectionPatchResource class. + */ + public EnclaveConnectionPatchResource() { + } + + /** + * Get the properties property: Enclave Connection Patch properties. + * + * @return the properties value. + */ + public UpdateEnclaveConnectionPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Enclave Connection Patch properties. + * + * @param properties the properties value to set. + * @return the EnclaveConnectionPatchResource object itself. + */ + public EnclaveConnectionPatchResource withProperties(UpdateEnclaveConnectionPatchProperties 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 EnclaveConnectionPatchResource object itself. + */ + public EnclaveConnectionPatchResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@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 EnclaveConnectionPatchResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveConnectionPatchResource 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 EnclaveConnectionPatchResource. + */ + public static EnclaveConnectionPatchResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveConnectionPatchResource deserializedEnclaveConnectionPatchResource + = new EnclaveConnectionPatchResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedEnclaveConnectionPatchResource.properties + = UpdateEnclaveConnectionPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEnclaveConnectionPatchResource.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveConnectionPatchResource; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionResource.java new file mode 100644 index 000000000000..4a8d5ed9c6e3 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionResource.java @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.EnclaveConnectionResourceInner; +import java.util.List; +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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the state property: The state of the enclaveConnection. + * + * @return the state value. + */ + EnclaveConnectionState state(); + + /** + * Gets the communityResourceId property: Community Resource Id. + * + * @return the communityResourceId value. + */ + String communityResourceId(); + + /** + * Gets the sourceResourceId property: Source Resource Id. + * + * @return the sourceResourceId value. + */ + String sourceResourceId(); + + /** + * Gets the sourceCidr property: Source CIDR. + * + * @return the sourceCidr value. + */ + String sourceCidr(); + + /** + * Gets the ipGroup property: Source IP group Resource Id. + * + * @return the ipGroup value. + */ + String ipGroup(); + + /** + * Gets the destinationEndpointId property: Destination Endpoint Resource Id. + * + * @return the destinationEndpointId value. + */ + String destinationEndpointId(); + + /** + * Gets the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the resourceCollection property: List of resource ids modified by enclave Connections. + * + * @return the resourceCollection value. + */ + List resourceCollection(); + + /** + * 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.mission.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.WithState, DefinitionStages.WithCommunityResourceId, + DefinitionStages.WithSourceResourceId, DefinitionStages.WithSourceCidr, DefinitionStages.WithIpGroup, + DefinitionStages.WithDestinationEndpointId, DefinitionStages.WithResourceCollection { + /** + * 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 state. + */ + interface WithState { + /** + * Specifies the state property: The state of the enclaveConnection.. + * + * @param state The state of the enclaveConnection. + * @return the next definition stage. + */ + WithCreate withState(EnclaveConnectionState state); + } + + /** + * The stage of the EnclaveConnectionResource definition allowing to specify communityResourceId. + */ + interface WithCommunityResourceId { + /** + * Specifies the communityResourceId property: Community Resource Id.. + * + * @param communityResourceId Community Resource Id. + * @return the next definition stage. + */ + WithCreate withCommunityResourceId(String communityResourceId); + } + + /** + * The stage of the EnclaveConnectionResource definition allowing to specify sourceResourceId. + */ + interface WithSourceResourceId { + /** + * Specifies the sourceResourceId property: Source Resource Id.. + * + * @param sourceResourceId Source Resource Id. + * @return the next definition stage. + */ + WithCreate withSourceResourceId(String sourceResourceId); + } + + /** + * The stage of the EnclaveConnectionResource definition allowing to specify sourceCidr. + */ + interface WithSourceCidr { + /** + * Specifies the sourceCidr property: Source CIDR.. + * + * @param sourceCidr Source CIDR. + * @return the next definition stage. + */ + WithCreate withSourceCidr(String sourceCidr); + } + + /** + * The stage of the EnclaveConnectionResource definition allowing to specify ipGroup. + */ + interface WithIpGroup { + /** + * Specifies the ipGroup property: Source IP group Resource Id.. + * + * @param ipGroup Source IP group Resource Id. + * @return the next definition stage. + */ + WithCreate withIpGroup(String ipGroup); + } + + /** + * The stage of the EnclaveConnectionResource definition allowing to specify destinationEndpointId. + */ + interface WithDestinationEndpointId { + /** + * Specifies the destinationEndpointId property: Destination Endpoint Resource Id.. + * + * @param destinationEndpointId Destination Endpoint Resource Id. + * @return the next definition stage. + */ + WithCreate withDestinationEndpointId(String destinationEndpointId); + } + + /** + * The stage of the EnclaveConnectionResource definition allowing to specify resourceCollection. + */ + interface WithResourceCollection { + /** + * Specifies the resourceCollection property: List of resource ids modified by enclave Connections.. + * + * @param resourceCollection List of resource ids modified by enclave Connections. + * @return the next definition stage. + */ + WithCreate withResourceCollection(List resourceCollection); + } + } + + /** + * 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(UpdateEnclaveConnectionPatchProperties 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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionResourceListResult.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionResourceListResult.java new file mode 100644 index 000000000000..7e65f57771bc --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionResourceListResult.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.fluent.models.EnclaveConnectionResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a EnclaveConnectionResource list operation. + */ +@Fluent +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. + */ + public EnclaveConnectionResourceListResult() { + } + + /** + * Get the value property: The EnclaveConnectionResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The EnclaveConnectionResource items on this page. + * + * @param value the value value to set. + * @return the EnclaveConnectionResourceListResult object itself. + */ + public EnclaveConnectionResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the EnclaveConnectionResourceListResult object itself. + */ + public EnclaveConnectionResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model EnclaveConnectionResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EnclaveConnectionResourceListResult.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionState.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionState.java new file mode 100644 index 000000000000..48c0150788d4 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnectionState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the state of the enclave connection. + */ +public final class EnclaveConnectionState extends ExpandableStringEnum { + /** + * Static value PendingApproval for EnclaveConnectionState. + */ + public static final EnclaveConnectionState PENDING_APPROVAL = fromString("PendingApproval"); + + /** + * Static value PendingUpdate for EnclaveConnectionState. + */ + public static final EnclaveConnectionState PENDING_UPDATE = fromString("PendingUpdate"); + + /** + * Static value Approved for EnclaveConnectionState. + */ + public static final EnclaveConnectionState APPROVED = fromString("Approved"); + + /** + * Static value Active for EnclaveConnectionState. + */ + public static final EnclaveConnectionState ACTIVE = fromString("Active"); + + /** + * Static value Failed for EnclaveConnectionState. + */ + public static final EnclaveConnectionState FAILED = fromString("Failed"); + + /** + * Static value Connected for EnclaveConnectionState. + */ + public static final EnclaveConnectionState CONNECTED = fromString("Connected"); + + /** + * Static value Disconnected for EnclaveConnectionState. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnections.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnections.java new file mode 100644 index 000000000000..ce3a2e295186 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveConnections.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveDefaultSettings.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveDefaultSettings.java new file mode 100644 index 000000000000..ba2a2fdf803d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveDefaultSettings.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 EnclaveDefaultSettings 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 EnclaveDefaultSettings class. + */ + public EnclaveDefaultSettings() { + } + + /** + * Get the keyVaultResourceId property: Key Vault Resource Id. + * + * @return the keyVaultResourceId value. + */ + public String keyVaultResourceId() { + return this.keyVaultResourceId; + } + + /** + * Set the keyVaultResourceId property: Key Vault Resource Id. + * + * @param keyVaultResourceId the keyVaultResourceId value to set. + * @return the EnclaveDefaultSettings object itself. + */ + public EnclaveDefaultSettings withKeyVaultResourceId(String keyVaultResourceId) { + this.keyVaultResourceId = keyVaultResourceId; + return this; + } + + /** + * Get the storageAccountResourceId property: Storage Account Resource Id. + * + * @return the storageAccountResourceId value. + */ + public String storageAccountResourceId() { + return this.storageAccountResourceId; + } + + /** + * Set the storageAccountResourceId property: Storage Account Resource Id. + * + * @param storageAccountResourceId the storageAccountResourceId value to set. + * @return the EnclaveDefaultSettings object itself. + */ + public EnclaveDefaultSettings withStorageAccountResourceId(String storageAccountResourceId) { + this.storageAccountResourceId = storageAccountResourceId; + return this; + } + + /** + * Get the logAnalyticsResourceIdCollection property: Log Analytics Resource Ids. + * + * @return the logAnalyticsResourceIdCollection value. + */ + public List logAnalyticsResourceIdCollection() { + return this.logAnalyticsResourceIdCollection; + } + + /** + * Set the logAnalyticsResourceIdCollection property: Log Analytics Resource Ids. + * + * @param logAnalyticsResourceIdCollection the logAnalyticsResourceIdCollection value to set. + * @return the EnclaveDefaultSettings object itself. + */ + public EnclaveDefaultSettings withLogAnalyticsResourceIdCollection(List logAnalyticsResourceIdCollection) { + this.logAnalyticsResourceIdCollection = logAnalyticsResourceIdCollection; + return this; + } + + /** + * 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 EnclaveDefaultSettings object itself. + */ + public EnclaveDefaultSettings withDiagnosticDestination(DiagnosticDestination diagnosticDestination) { + this.diagnosticDestination = diagnosticDestination; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keyVaultResourceId", this.keyVaultResourceId); + jsonWriter.writeStringField("storageAccountResourceId", this.storageAccountResourceId); + jsonWriter.writeArrayField("logAnalyticsResourceIdCollection", this.logAnalyticsResourceIdCollection, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("diagnosticDestination", + this.diagnosticDestination == null ? null : this.diagnosticDestination.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveDefaultSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveDefaultSettings 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 EnclaveDefaultSettings. + */ + public static EnclaveDefaultSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveDefaultSettings deserializedEnclaveDefaultSettings = new EnclaveDefaultSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyVaultResourceId".equals(fieldName)) { + deserializedEnclaveDefaultSettings.keyVaultResourceId = reader.getString(); + } else if ("storageAccountResourceId".equals(fieldName)) { + deserializedEnclaveDefaultSettings.storageAccountResourceId = reader.getString(); + } else if ("logAnalyticsResourceIdCollection".equals(fieldName)) { + List logAnalyticsResourceIdCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedEnclaveDefaultSettings.logAnalyticsResourceIdCollection + = logAnalyticsResourceIdCollection; + } else if ("diagnosticDestination".equals(fieldName)) { + deserializedEnclaveDefaultSettings.diagnosticDestination + = DiagnosticDestination.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveDefaultSettings; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointDestinationRule.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointDestinationRule.java new file mode 100644 index 000000000000..4e7d0c96be8d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointDestinationRule.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /* + * Endpoint Rule Name. + */ + private String name; + + /* + * 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 port; + + /* + * Protocols. Options specified by Endpoint Protocol Enum. + */ + private List protocols; + + /** + * Creates an instance of EnclaveEndpointDestinationRule class. + */ + public EnclaveEndpointDestinationRule() { + } + + /** + * Get the name property: Endpoint Rule Name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Endpoint Rule Name. + * + * @param name the name value to set. + * @return the EnclaveEndpointDestinationRule object itself. + */ + public EnclaveEndpointDestinationRule withName(String name) { + this.name = name; + 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 port property: Port. Can include multiple ports separated by commas or a range indicated by a hyphen. + * + * @return the port value. + */ + public String port() { + return this.port; + } + + /** + * Set the port property: Port. Can include multiple ports separated by commas or a range indicated by a hyphen. + * + * @param port the port value to set. + * @return the EnclaveEndpointDestinationRule object itself. + */ + public EnclaveEndpointDestinationRule withPort(String port) { + this.port = port; + 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 EnclaveEndpointDestinationRule object itself. + */ + public EnclaveEndpointDestinationRule withProtocols(List protocols) { + this.protocols = protocols; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("destination", this.destination); + jsonWriter.writeStringField("port", this.port); + jsonWriter.writeArrayField("protocols", this.protocols, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + 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 ("name".equals(fieldName)) { + deserializedEnclaveEndpointDestinationRule.name = reader.getString(); + } else if ("destination".equals(fieldName)) { + deserializedEnclaveEndpointDestinationRule.destination = reader.getString(); + } else if ("port".equals(fieldName)) { + deserializedEnclaveEndpointDestinationRule.port = reader.getString(); + } else if ("protocols".equals(fieldName)) { + List protocols + = reader.readArray(reader1 -> EnclaveEndpointProtocol.fromString(reader1.getString())); + deserializedEnclaveEndpointDestinationRule.protocols = protocols; + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveEndpointDestinationRule; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointPatchResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointPatchResource.java new file mode 100644 index 000000000000..6627e44d091b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointPatchResource.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 EnclaveEndpointPatchResource implements JsonSerializable { + /* + * Enclave Endpoint Patch properties + */ + private UpdateEnclaveEndpointPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of EnclaveEndpointPatchResource class. + */ + public EnclaveEndpointPatchResource() { + } + + /** + * Get the properties property: Enclave Endpoint Patch properties. + * + * @return the properties value. + */ + public UpdateEnclaveEndpointPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Enclave Endpoint Patch properties. + * + * @param properties the properties value to set. + * @return the EnclaveEndpointPatchResource object itself. + */ + public EnclaveEndpointPatchResource withProperties(UpdateEnclaveEndpointPatchProperties 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 EnclaveEndpointPatchResource object itself. + */ + public EnclaveEndpointPatchResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@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 EnclaveEndpointPatchResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveEndpointPatchResource 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 EnclaveEndpointPatchResource. + */ + public static EnclaveEndpointPatchResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveEndpointPatchResource deserializedEnclaveEndpointPatchResource = new EnclaveEndpointPatchResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedEnclaveEndpointPatchResource.properties + = UpdateEnclaveEndpointPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedEnclaveEndpointPatchResource.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveEndpointPatchResource; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointProtocol.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointProtocol.java new file mode 100644 index 000000000000..4788869f21b6 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointProtocol.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enclave Endpoint Protocol Enum. + */ +public final class EnclaveEndpointProtocol extends ExpandableStringEnum { + /** + * Static value ANY for EnclaveEndpointProtocol. + */ + public static final EnclaveEndpointProtocol ANY = fromString("ANY"); + + /** + * Static value TCP for EnclaveEndpointProtocol. + */ + public static final EnclaveEndpointProtocol TCP = fromString("TCP"); + + /** + * Static value UDP for EnclaveEndpointProtocol. + */ + public static final EnclaveEndpointProtocol UDP = fromString("UDP"); + + /** + * Static value ICMP for EnclaveEndpointProtocol. + */ + public static final EnclaveEndpointProtocol ICMP = fromString("ICMP"); + + /** + * Static value ESP for EnclaveEndpointProtocol. + */ + public static final EnclaveEndpointProtocol ESP = fromString("ESP"); + + /** + * Static value AH for EnclaveEndpointProtocol. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointResource.java new file mode 100644 index 000000000000..e34ebf1ce1e7 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointResource.java @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.EnclaveEndpointResourceInner; +import java.util.List; +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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the ruleCollection property: Enclave Endpoint Rule Collection. + * + * @return the ruleCollection value. + */ + List ruleCollection(); + + /** + * Gets the resourceCollection property: List of resource ids created by community endpoint. + * + * @return the resourceCollection value. + */ + List resourceCollection(); + + /** + * Gets the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * 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.mission.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.WithRuleCollection, + DefinitionStages.WithResourceCollection { + /** + * 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 ruleCollection. + */ + interface WithRuleCollection { + /** + * Specifies the ruleCollection property: Enclave Endpoint Rule Collection.. + * + * @param ruleCollection Enclave Endpoint Rule Collection. + * @return the next definition stage. + */ + WithCreate withRuleCollection(List ruleCollection); + } + + /** + * The stage of the EnclaveEndpointResource definition allowing to specify resourceCollection. + */ + interface WithResourceCollection { + /** + * Specifies the resourceCollection property: List of resource ids created by community endpoint.. + * + * @param resourceCollection List of resource ids created by community endpoint. + * @return the next definition stage. + */ + WithCreate withResourceCollection(List resourceCollection); + } + } + + /** + * 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(UpdateEnclaveEndpointPatchProperties 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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointResourceListResult.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointResourceListResult.java new file mode 100644 index 000000000000..e5e1a9ac477d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpointResourceListResult.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.fluent.models.EnclaveEndpointResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a EnclaveEndpointResource list operation. + */ +@Fluent +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. + */ + public EnclaveEndpointResourceListResult() { + } + + /** + * Get the value property: The EnclaveEndpointResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The EnclaveEndpointResource items on this page. + * + * @param value the value value to set. + * @return the EnclaveEndpointResourceListResult object itself. + */ + public EnclaveEndpointResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the EnclaveEndpointResourceListResult object itself. + */ + public EnclaveEndpointResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model EnclaveEndpointResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EnclaveEndpointResourceListResult.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpoints.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpoints.java new file mode 100644 index 000000000000..405ee3f20217 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveEndpoints.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveResource.java new file mode 100644 index 000000000000..a5d5ceb80e64 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveResource.java @@ -0,0 +1,525 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.EnclaveResourceInner; +import java.util.List; +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 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 provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the enclaveVirtualNetwork property: Virtual Network. + * + * @return the enclaveVirtualNetwork value. + */ + EnclaveVirtualNetwork enclaveVirtualNetwork(); + + /** + * Gets the enclaveAddressSpaces property: Enclave Address Spaces. + * + * @return the enclaveAddressSpaces value. + */ + EnclaveAddressSpaces enclaveAddressSpaces(); + + /** + * Gets the communityResourceId property: Community Resource Id. + * + * @return the communityResourceId value. + */ + String communityResourceId(); + + /** + * Gets the enclaveDefaultSettings property: Default Settings. + * + * @return the enclaveDefaultSettings value. + */ + EnclaveDefaultSettings enclaveDefaultSettings(); + + /** + * Gets the resourceCollection property: List of resource ids created by Virtual Enclave. + * + * @return the resourceCollection value. + */ + List resourceCollection(); + + /** + * Gets the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @return the managedResourceGroupConfiguration value. + */ + ManagedResourceGroupConfiguration managedResourceGroupConfiguration(); + + /** + * Gets the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @return the maintenanceModeConfiguration value. + */ + MaintenanceModeConfiguration maintenanceModeConfiguration(); + + /** + * Gets the bastionEnabled property: Deploy Bastion service (True or False). + * + * @return the bastionEnabled value. + */ + Boolean bastionEnabled(); + + /** + * Gets the enclaveRoleAssignments property: Enclave role assignments. + * + * @return the enclaveRoleAssignments value. + */ + List enclaveRoleAssignments(); + + /** + * Gets the workloadRoleAssignments property: Workload role assignments. + * + * @return the workloadRoleAssignments value. + */ + List workloadRoleAssignments(); + + /** + * 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.mission.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.WithIdentity, + DefinitionStages.WithEnclaveVirtualNetwork, DefinitionStages.WithCommunityResourceId, + DefinitionStages.WithEnclaveDefaultSettings, DefinitionStages.WithResourceCollection, + DefinitionStages.WithManagedResourceGroupConfiguration, DefinitionStages.WithMaintenanceModeConfiguration, + DefinitionStages.WithBastionEnabled, DefinitionStages.WithEnclaveRoleAssignments, + DefinitionStages.WithWorkloadRoleAssignments { + /** + * 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 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); + } + + /** + * The stage of the EnclaveResource definition allowing to specify enclaveVirtualNetwork. + */ + interface WithEnclaveVirtualNetwork { + /** + * Specifies the enclaveVirtualNetwork property: Virtual Network.. + * + * @param enclaveVirtualNetwork Virtual Network. + * @return the next definition stage. + */ + WithCreate withEnclaveVirtualNetwork(EnclaveVirtualNetwork enclaveVirtualNetwork); + } + + /** + * The stage of the EnclaveResource definition allowing to specify communityResourceId. + */ + interface WithCommunityResourceId { + /** + * Specifies the communityResourceId property: Community Resource Id.. + * + * @param communityResourceId Community Resource Id. + * @return the next definition stage. + */ + WithCreate withCommunityResourceId(String communityResourceId); + } + + /** + * The stage of the EnclaveResource definition allowing to specify enclaveDefaultSettings. + */ + interface WithEnclaveDefaultSettings { + /** + * Specifies the enclaveDefaultSettings property: Default Settings. + * + * @param enclaveDefaultSettings Default Settings. + * @return the next definition stage. + */ + WithCreate withEnclaveDefaultSettings(EnclaveDefaultSettings enclaveDefaultSettings); + } + + /** + * The stage of the EnclaveResource definition allowing to specify resourceCollection. + */ + interface WithResourceCollection { + /** + * Specifies the resourceCollection property: List of resource ids created by Virtual Enclave.. + * + * @param resourceCollection List of resource ids created by Virtual Enclave. + * @return the next definition stage. + */ + WithCreate withResourceCollection(List resourceCollection); + } + + /** + * The stage of the EnclaveResource definition allowing to specify managedResourceGroupConfiguration. + */ + interface WithManagedResourceGroupConfiguration { + /** + * Specifies the managedResourceGroupConfiguration property: Managed resource group configuration.. + * + * @param managedResourceGroupConfiguration Managed resource group configuration. + * @return the next definition stage. + */ + WithCreate withManagedResourceGroupConfiguration( + ManagedResourceGroupConfiguration managedResourceGroupConfiguration); + } + + /** + * The stage of the EnclaveResource definition allowing to specify maintenanceModeConfiguration. + */ + interface WithMaintenanceModeConfiguration { + /** + * Specifies the maintenanceModeConfiguration property: Maintenance Mode configuration.. + * + * @param maintenanceModeConfiguration Maintenance Mode configuration. + * @return the next definition stage. + */ + WithCreate withMaintenanceModeConfiguration(MaintenanceModeConfiguration maintenanceModeConfiguration); + } + + /** + * The stage of the EnclaveResource definition allowing to specify bastionEnabled. + */ + interface WithBastionEnabled { + /** + * Specifies the bastionEnabled property: Deploy Bastion service (True or False).. + * + * @param bastionEnabled Deploy Bastion service (True or False). + * @return the next definition stage. + */ + WithCreate withBastionEnabled(Boolean bastionEnabled); + } + + /** + * The stage of the EnclaveResource definition allowing to specify enclaveRoleAssignments. + */ + interface WithEnclaveRoleAssignments { + /** + * Specifies the enclaveRoleAssignments property: Enclave role assignments. + * + * @param enclaveRoleAssignments Enclave role assignments. + * @return the next definition stage. + */ + WithCreate withEnclaveRoleAssignments(List enclaveRoleAssignments); + } + + /** + * The stage of the EnclaveResource definition allowing to specify workloadRoleAssignments. + */ + interface WithWorkloadRoleAssignments { + /** + * Specifies the workloadRoleAssignments property: Workload role assignments. + * + * @param workloadRoleAssignments Workload role assignments. + * @return the next definition stage. + */ + WithCreate withWorkloadRoleAssignments(List workloadRoleAssignments); + } + } + + /** + * 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(UpdateVirtualEnclavePatchProperties 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(AzureResourceManagerCommonTypesManagedServiceIdentityUpdate 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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(ApprovalDeletionCallbackRequest body, Context context); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveResourceListResult.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveResourceListResult.java new file mode 100644 index 000000000000..d0f2f1f4bdf7 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveResourceListResult.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.fluent.models.EnclaveResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a EnclaveResource list operation. + */ +@Fluent +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. + */ + public EnclaveResourceListResult() { + } + + /** + * Get the value property: The EnclaveResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The EnclaveResource items on this page. + * + * @param value the value value to set. + * @return the EnclaveResourceListResult object itself. + */ + public EnclaveResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the EnclaveResourceListResult object itself. + */ + public EnclaveResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property value in model EnclaveResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EnclaveResourceListResult.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveVirtualNetwork.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveVirtualNetwork.java new file mode 100644 index 000000000000..9d31cecc0fce --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/EnclaveVirtualNetwork.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 EnclaveVirtualNetwork implements JsonSerializable { + /* + * Network Name. + */ + private String name; + + /* + * Network Size. + */ + private String networkSize; + + /* + * Custom CIDR Range. + */ + private String customCidrRange; + + /* + * Subnet Configurations. + */ + private List subnetConfigurations; + + /* + * Allow Subnet Communication. + */ + private Boolean allowSubnetCommunication; + + /* + * Connect to Azure Services (True or False). + */ + private Boolean connectToAzureServices; + + /** + * Creates an instance of EnclaveVirtualNetwork class. + */ + public EnclaveVirtualNetwork() { + } + + /** + * Get the name property: Network Name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Network Name. + * + * @param name the name value to set. + * @return the EnclaveVirtualNetwork object itself. + */ + public EnclaveVirtualNetwork withName(String name) { + this.name = name; + 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 EnclaveVirtualNetwork object itself. + */ + public EnclaveVirtualNetwork 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 EnclaveVirtualNetwork object itself. + */ + public EnclaveVirtualNetwork 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 EnclaveVirtualNetwork object itself. + */ + public EnclaveVirtualNetwork 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 EnclaveVirtualNetwork object itself. + */ + public EnclaveVirtualNetwork withAllowSubnetCommunication(Boolean allowSubnetCommunication) { + this.allowSubnetCommunication = allowSubnetCommunication; + return this; + } + + /** + * Get the connectToAzureServices property: Connect to Azure Services (True or False). + * + * @return the connectToAzureServices value. + */ + public Boolean connectToAzureServices() { + return this.connectToAzureServices; + } + + /** + * Set the connectToAzureServices property: Connect to Azure Services (True or False). + * + * @param connectToAzureServices the connectToAzureServices value to set. + * @return the EnclaveVirtualNetwork object itself. + */ + public EnclaveVirtualNetwork withConnectToAzureServices(Boolean connectToAzureServices) { + this.connectToAzureServices = connectToAzureServices; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subnetConfigurations() != null) { + subnetConfigurations().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + 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); + jsonWriter.writeBooleanField("connectToAzureServices", this.connectToAzureServices); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EnclaveVirtualNetwork from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EnclaveVirtualNetwork 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 EnclaveVirtualNetwork. + */ + public static EnclaveVirtualNetwork fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EnclaveVirtualNetwork deserializedEnclaveVirtualNetwork = new EnclaveVirtualNetwork(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedEnclaveVirtualNetwork.name = reader.getString(); + } else if ("networkSize".equals(fieldName)) { + deserializedEnclaveVirtualNetwork.networkSize = reader.getString(); + } else if ("customCidrRange".equals(fieldName)) { + deserializedEnclaveVirtualNetwork.customCidrRange = reader.getString(); + } else if ("subnetConfigurations".equals(fieldName)) { + List subnetConfigurations + = reader.readArray(reader1 -> SubnetConfiguration.fromJson(reader1)); + deserializedEnclaveVirtualNetwork.subnetConfigurations = subnetConfigurations; + } else if ("allowSubnetCommunication".equals(fieldName)) { + deserializedEnclaveVirtualNetwork.allowSubnetCommunication + = reader.getNullable(JsonReader::getBoolean); + } else if ("connectToAzureServices".equals(fieldName)) { + deserializedEnclaveVirtualNetwork.connectToAzureServices + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedEnclaveVirtualNetwork; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/GovernedServiceItem.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/GovernedServiceItem.java new file mode 100644 index 000000000000..c098dffafd36 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/GovernedServiceItem.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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 id; + + /* + * service name + */ + private String name; + + /* + * governance option for this service (Allow, Deny, ExceptionOnly, or NotApplicable). + */ + private GovernedServiceItemOption option; + + /* + * initiative enforcement (Enabled or Disabled). + */ + private GovernedServiceItemEnforcement enforcement; + + /* + * policies set to auditOnly (True or False). + */ + private Boolean auditOnly; + + /* + * initiatives associated with this service + */ + private List initiatives; + + /** + * Creates an instance of GovernedServiceItem class. + */ + public GovernedServiceItem() { + } + + /** + * Get the id property: service id. + * + * @return the id value. + */ + public ServiceIdentifier id() { + return this.id; + } + + /** + * Set the id property: service id. + * + * @param id the id value to set. + * @return the GovernedServiceItem object itself. + */ + public GovernedServiceItem withId(ServiceIdentifier id) { + this.id = id; + return this; + } + + /** + * Get the name property: service name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * 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 auditOnly property: policies set to auditOnly (True or False). + * + * @return the auditOnly value. + */ + public Boolean auditOnly() { + return this.auditOnly; + } + + /** + * Set the auditOnly property: policies set to auditOnly (True or False). + * + * @param auditOnly the auditOnly value to set. + * @return the GovernedServiceItem object itself. + */ + public GovernedServiceItem withAuditOnly(Boolean auditOnly) { + this.auditOnly = auditOnly; + return this; + } + + /** + * Get the initiatives property: initiatives associated with this service. + * + * @return the initiatives value. + */ + public List initiatives() { + return this.initiatives; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model GovernedServiceItem")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GovernedServiceItem.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id == null ? null : this.id.toString()); + jsonWriter.writeStringField("option", this.option == null ? null : this.option.toString()); + jsonWriter.writeStringField("enforcement", this.enforcement == null ? null : this.enforcement.toString()); + jsonWriter.writeBooleanField("auditOnly", this.auditOnly); + 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 ("id".equals(fieldName)) { + deserializedGovernedServiceItem.id = ServiceIdentifier.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedGovernedServiceItem.name = 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 ("auditOnly".equals(fieldName)) { + deserializedGovernedServiceItem.auditOnly = reader.getNullable(JsonReader::getBoolean); + } else if ("initiatives".equals(fieldName)) { + List initiatives = reader.readArray(reader1 -> reader1.getString()); + deserializedGovernedServiceItem.initiatives = initiatives; + } else { + reader.skipChildren(); + } + } + + return deserializedGovernedServiceItem; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/GovernedServiceItemEnforcement.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/GovernedServiceItemEnforcement.java new file mode 100644 index 000000000000..8eb2840772b3 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/GovernedServiceItemEnforcement.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * initiative enforcement (Enabled or Disabled). + */ +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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/GovernedServiceItemOption.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/GovernedServiceItemOption.java new file mode 100644 index 000000000000..3163fa81b15a --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/GovernedServiceItemOption.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * governance option for this service (Allow, Deny, ExceptionOnly, or NotApplicable). + */ +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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/InitiatorCallbackRequest.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/InitiatorCallbackRequest.java new file mode 100644 index 000000000000..7b245b52606d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/InitiatorCallbackRequest.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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 InitiatorCallbackRequest implements JsonSerializable { + /* + * Approval status indicating 'Approved' or 'Rejected' + */ + private InitiatorCallbackRequestApprovalStatus approvalStatus; + + /** + * Creates an instance of InitiatorCallbackRequest class. + */ + public InitiatorCallbackRequest() { + } + + /** + * Get the approvalStatus property: Approval status indicating 'Approved' or 'Rejected'. + * + * @return the approvalStatus value. + */ + public InitiatorCallbackRequestApprovalStatus approvalStatus() { + return this.approvalStatus; + } + + /** + * Set the approvalStatus property: Approval status indicating 'Approved' or 'Rejected'. + * + * @param approvalStatus the approvalStatus value to set. + * @return the InitiatorCallbackRequest object itself. + */ + public InitiatorCallbackRequest withApprovalStatus(InitiatorCallbackRequestApprovalStatus approvalStatus) { + this.approvalStatus = approvalStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (approvalStatus() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property approvalStatus in model InitiatorCallbackRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(InitiatorCallbackRequest.class); + + /** + * {@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 InitiatorCallbackRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InitiatorCallbackRequest 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 InitiatorCallbackRequest. + */ + public static InitiatorCallbackRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InitiatorCallbackRequest deserializedInitiatorCallbackRequest = new InitiatorCallbackRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("approvalStatus".equals(fieldName)) { + deserializedInitiatorCallbackRequest.approvalStatus + = InitiatorCallbackRequestApprovalStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedInitiatorCallbackRequest; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/InitiatorCallbackRequestApprovalStatus.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/InitiatorCallbackRequestApprovalStatus.java new file mode 100644 index 000000000000..9465bfdf6601 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/InitiatorCallbackRequestApprovalStatus.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Approval status indicating 'Approved' or 'Rejected'. + */ +public final class InitiatorCallbackRequestApprovalStatus + extends ExpandableStringEnum { + /** + * Static value Approved for InitiatorCallbackRequestApprovalStatus. + */ + public static final InitiatorCallbackRequestApprovalStatus APPROVED = fromString("Approved"); + + /** + * Static value Rejected for InitiatorCallbackRequestApprovalStatus. + */ + public static final InitiatorCallbackRequestApprovalStatus REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of InitiatorCallbackRequestApprovalStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public InitiatorCallbackRequestApprovalStatus() { + } + + /** + * Creates or finds a InitiatorCallbackRequestApprovalStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding InitiatorCallbackRequestApprovalStatus. + */ + public static InitiatorCallbackRequestApprovalStatus fromString(String name) { + return fromString(name, InitiatorCallbackRequestApprovalStatus.class); + } + + /** + * Gets known InitiatorCallbackRequestApprovalStatus values. + * + * @return known InitiatorCallbackRequestApprovalStatus values. + */ + public static Collection values() { + return values(InitiatorCallbackRequestApprovalStatus.class); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/InitiatorCallbackResponse.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/InitiatorCallbackResponse.java new file mode 100644 index 000000000000..ed252e8d2dad --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/InitiatorCallbackResponse.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.resourcemanager.mission.fluent.models.InitiatorCallbackResponseInner; + +/** + * An immutable client-side representation of InitiatorCallbackResponse. + */ +public interface InitiatorCallbackResponse { + /** + * Gets the message property: Confirmation message indicating the result of the operation. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.mission.fluent.models.InitiatorCallbackResponseInner object. + * + * @return the inner object. + */ + InitiatorCallbackResponseInner innerModel(); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfiguration.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfiguration.java new file mode 100644 index 000000000000..5652ecf80880 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfiguration.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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 MaintenanceModeConfiguration implements JsonSerializable { + /* + * Current mode of Maintenance Mode Configuration + */ + private MaintenanceModeConfigurationMode mode; + + /* + * The user, group or service principal object affected by Maintenance Mode + */ + private List principals; + + /* + * Justification for entering or exiting Maintenance Mode + */ + private MaintenanceModeConfigurationJustification justification; + + /** + * Creates an instance of MaintenanceModeConfiguration class. + */ + public MaintenanceModeConfiguration() { + } + + /** + * Get the mode property: Current mode of Maintenance Mode Configuration. + * + * @return the mode value. + */ + public MaintenanceModeConfigurationMode mode() { + return this.mode; + } + + /** + * Set the mode property: Current mode of Maintenance Mode Configuration. + * + * @param mode the mode value to set. + * @return the MaintenanceModeConfiguration object itself. + */ + public MaintenanceModeConfiguration withMode(MaintenanceModeConfigurationMode 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 MaintenanceModeConfiguration object itself. + */ + public MaintenanceModeConfiguration withPrincipals(List principals) { + this.principals = principals; + return this; + } + + /** + * Get the justification property: Justification for entering or exiting Maintenance Mode. + * + * @return the justification value. + */ + public MaintenanceModeConfigurationJustification justification() { + return this.justification; + } + + /** + * Set the justification property: Justification for entering or exiting Maintenance Mode. + * + * @param justification the justification value to set. + * @return the MaintenanceModeConfiguration object itself. + */ + public MaintenanceModeConfiguration withJustification(MaintenanceModeConfigurationJustification justification) { + this.justification = justification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (mode() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property mode in model MaintenanceModeConfiguration")); + } + if (principals() != null) { + principals().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MaintenanceModeConfiguration.class); + + /** + * {@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 MaintenanceModeConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MaintenanceModeConfiguration 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 MaintenanceModeConfiguration. + */ + public static MaintenanceModeConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MaintenanceModeConfiguration deserializedMaintenanceModeConfiguration = new MaintenanceModeConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mode".equals(fieldName)) { + deserializedMaintenanceModeConfiguration.mode + = MaintenanceModeConfigurationMode.fromString(reader.getString()); + } else if ("principals".equals(fieldName)) { + List principals = reader.readArray(reader1 -> Principal.fromJson(reader1)); + deserializedMaintenanceModeConfiguration.principals = principals; + } else if ("justification".equals(fieldName)) { + deserializedMaintenanceModeConfiguration.justification + = MaintenanceModeConfigurationJustification.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMaintenanceModeConfiguration; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationJustification.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationJustification.java new file mode 100644 index 000000000000..f441bcb26369 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationJustification.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Justification for entering or exiting Maintenance Mode. + */ +public final class MaintenanceModeConfigurationJustification + extends ExpandableStringEnum { + /** + * Static value Networking for MaintenanceModeConfigurationJustification. + */ + public static final MaintenanceModeConfigurationJustification NETWORKING = fromString("Networking"); + + /** + * Static value Governance for MaintenanceModeConfigurationJustification. + */ + public static final MaintenanceModeConfigurationJustification GOVERNANCE = fromString("Governance"); + + /** + * Static value Off for MaintenanceModeConfigurationJustification. + */ + public static final MaintenanceModeConfigurationJustification OFF = fromString("Off"); + + /** + * Creates a new instance of MaintenanceModeConfigurationJustification value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MaintenanceModeConfigurationJustification() { + } + + /** + * Creates or finds a MaintenanceModeConfigurationJustification from its string representation. + * + * @param name a name to look for. + * @return the corresponding MaintenanceModeConfigurationJustification. + */ + public static MaintenanceModeConfigurationJustification fromString(String name) { + return fromString(name, MaintenanceModeConfigurationJustification.class); + } + + /** + * Gets known MaintenanceModeConfigurationJustification values. + * + * @return known MaintenanceModeConfigurationJustification values. + */ + public static Collection values() { + return values(MaintenanceModeConfigurationJustification.class); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationMode.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationMode.java new file mode 100644 index 000000000000..55f11c39262d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationMode.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Current mode of Maintenance Mode Configuration. + */ +public final class MaintenanceModeConfigurationMode extends ExpandableStringEnum { + /** + * Static value On for MaintenanceModeConfigurationMode. + */ + public static final MaintenanceModeConfigurationMode ON = fromString("On"); + + /** + * Static value CanNotDelete for MaintenanceModeConfigurationMode. + */ + public static final MaintenanceModeConfigurationMode CAN_NOT_DELETE = fromString("CanNotDelete"); + + /** + * Static value Off for MaintenanceModeConfigurationMode. + */ + public static final MaintenanceModeConfigurationMode OFF = fromString("Off"); + + /** + * Creates a new instance of MaintenanceModeConfigurationMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MaintenanceModeConfigurationMode() { + } + + /** + * Creates or finds a MaintenanceModeConfigurationMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding MaintenanceModeConfigurationMode. + */ + public static MaintenanceModeConfigurationMode fromString(String name) { + return fromString(name, MaintenanceModeConfigurationMode.class); + } + + /** + * Gets known MaintenanceModeConfigurationMode values. + * + * @return known MaintenanceModeConfigurationMode values. + */ + public static Collection values() { + return values(MaintenanceModeConfigurationMode.class); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationUpdate.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationUpdate.java new file mode 100644 index 000000000000..680eb6a24066 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationUpdate.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 MaintenanceModeConfigurationUpdate implements JsonSerializable { + /* + * Current mode of Maintenance Mode Configuration + */ + private MaintenanceModeConfigurationUpdateMode mode; + + /* + * The user, group or service principal object affected by Maintenance Mode + */ + private List principals; + + /* + * Justification for entering or exiting Maintenance Mode + */ + private MaintenanceModeConfigurationUpdateJustification justification; + + /** + * Creates an instance of MaintenanceModeConfigurationUpdate class. + */ + public MaintenanceModeConfigurationUpdate() { + } + + /** + * Get the mode property: Current mode of Maintenance Mode Configuration. + * + * @return the mode value. + */ + public MaintenanceModeConfigurationUpdateMode mode() { + return this.mode; + } + + /** + * Set the mode property: Current mode of Maintenance Mode Configuration. + * + * @param mode the mode value to set. + * @return the MaintenanceModeConfigurationUpdate object itself. + */ + public MaintenanceModeConfigurationUpdate withMode(MaintenanceModeConfigurationUpdateMode 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 MaintenanceModeConfigurationUpdate object itself. + */ + public MaintenanceModeConfigurationUpdate withPrincipals(List principals) { + this.principals = principals; + return this; + } + + /** + * Get the justification property: Justification for entering or exiting Maintenance Mode. + * + * @return the justification value. + */ + public MaintenanceModeConfigurationUpdateJustification justification() { + return this.justification; + } + + /** + * Set the justification property: Justification for entering or exiting Maintenance Mode. + * + * @param justification the justification value to set. + * @return the MaintenanceModeConfigurationUpdate object itself. + */ + public MaintenanceModeConfigurationUpdate + withJustification(MaintenanceModeConfigurationUpdateJustification justification) { + this.justification = justification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (principals() != null) { + principals().forEach(e -> e.validate()); + } + } + + /** + * {@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 MaintenanceModeConfigurationUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MaintenanceModeConfigurationUpdate 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 MaintenanceModeConfigurationUpdate. + */ + public static MaintenanceModeConfigurationUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MaintenanceModeConfigurationUpdate deserializedMaintenanceModeConfigurationUpdate + = new MaintenanceModeConfigurationUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("mode".equals(fieldName)) { + deserializedMaintenanceModeConfigurationUpdate.mode + = MaintenanceModeConfigurationUpdateMode.fromString(reader.getString()); + } else if ("principals".equals(fieldName)) { + List principals = reader.readArray(reader1 -> Principal.fromJson(reader1)); + deserializedMaintenanceModeConfigurationUpdate.principals = principals; + } else if ("justification".equals(fieldName)) { + deserializedMaintenanceModeConfigurationUpdate.justification + = MaintenanceModeConfigurationUpdateJustification.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMaintenanceModeConfigurationUpdate; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationUpdateJustification.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationUpdateJustification.java new file mode 100644 index 000000000000..44fa597f01fc --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationUpdateJustification.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Justification for entering or exiting Maintenance Mode. + */ +public final class MaintenanceModeConfigurationUpdateJustification + extends ExpandableStringEnum { + /** + * Static value Networking for MaintenanceModeConfigurationUpdateJustification. + */ + public static final MaintenanceModeConfigurationUpdateJustification NETWORKING = fromString("Networking"); + + /** + * Static value Governance for MaintenanceModeConfigurationUpdateJustification. + */ + public static final MaintenanceModeConfigurationUpdateJustification GOVERNANCE = fromString("Governance"); + + /** + * Static value Off for MaintenanceModeConfigurationUpdateJustification. + */ + public static final MaintenanceModeConfigurationUpdateJustification OFF = fromString("Off"); + + /** + * Creates a new instance of MaintenanceModeConfigurationUpdateJustification value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MaintenanceModeConfigurationUpdateJustification() { + } + + /** + * Creates or finds a MaintenanceModeConfigurationUpdateJustification from its string representation. + * + * @param name a name to look for. + * @return the corresponding MaintenanceModeConfigurationUpdateJustification. + */ + public static MaintenanceModeConfigurationUpdateJustification fromString(String name) { + return fromString(name, MaintenanceModeConfigurationUpdateJustification.class); + } + + /** + * Gets known MaintenanceModeConfigurationUpdateJustification values. + * + * @return known MaintenanceModeConfigurationUpdateJustification values. + */ + public static Collection values() { + return values(MaintenanceModeConfigurationUpdateJustification.class); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationUpdateMode.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationUpdateMode.java new file mode 100644 index 000000000000..d10e625e4727 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MaintenanceModeConfigurationUpdateMode.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Current mode of Maintenance Mode Configuration. + */ +public final class MaintenanceModeConfigurationUpdateMode + extends ExpandableStringEnum { + /** + * Static value On for MaintenanceModeConfigurationUpdateMode. + */ + public static final MaintenanceModeConfigurationUpdateMode ON = fromString("On"); + + /** + * Static value CanNotDelete for MaintenanceModeConfigurationUpdateMode. + */ + public static final MaintenanceModeConfigurationUpdateMode CAN_NOT_DELETE = fromString("CanNotDelete"); + + /** + * Static value Off for MaintenanceModeConfigurationUpdateMode. + */ + public static final MaintenanceModeConfigurationUpdateMode OFF = fromString("Off"); + + /** + * Creates a new instance of MaintenanceModeConfigurationUpdateMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MaintenanceModeConfigurationUpdateMode() { + } + + /** + * Creates or finds a MaintenanceModeConfigurationUpdateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding MaintenanceModeConfigurationUpdateMode. + */ + public static MaintenanceModeConfigurationUpdateMode fromString(String name) { + return fromString(name, MaintenanceModeConfigurationUpdateMode.class); + } + + /** + * Gets known MaintenanceModeConfigurationUpdateMode values. + * + * @return known MaintenanceModeConfigurationUpdateMode values. + */ + public static Collection values() { + return values(MaintenanceModeConfigurationUpdateMode.class); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedResourceGroupConfiguration.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedResourceGroupConfiguration.java new file mode 100644 index 000000000000..c53eb2f19c66 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedResourceGroupConfiguration.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + +/** + * ManagedResourceGroup related properties. + */ +@Fluent +public final class ManagedResourceGroupConfiguration implements JsonSerializable { + /* + * Name of managed resource group + */ + private String name; + + /* + * The geo-location where the resource lives + */ + private String location; + + /** + * Creates an instance of ManagedResourceGroupConfiguration class. + */ + public ManagedResourceGroupConfiguration() { + } + + /** + * Get the name property: Name of managed resource group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of managed resource group. + * + * @param name the name value to set. + * @return the ManagedResourceGroupConfiguration object itself. + */ + public ManagedResourceGroupConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the ManagedResourceGroupConfiguration object itself. + */ + public ManagedResourceGroupConfiguration withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedResourceGroupConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedResourceGroupConfiguration 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 ManagedResourceGroupConfiguration. + */ + public static ManagedResourceGroupConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedResourceGroupConfiguration deserializedManagedResourceGroupConfiguration + = new ManagedResourceGroupConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedManagedResourceGroupConfiguration.name = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedManagedResourceGroupConfiguration.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedResourceGroupConfiguration; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedServiceIdentity.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..3146ee35ee01 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedServiceIdentity.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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; +import java.util.UUID; + +/** + * 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 UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will + * be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/ + * userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. + */ + 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 UUID 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 UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @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 set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); + + /** + * {@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.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedServiceIdentityType.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..72a1a98a2e0d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /** + * Static value None for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * Static value SystemAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Static value UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Static value SystemAssigned,UserAssigned for ManagedServiceIdentityType. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedServiceIdentityUserAssignedIdentities.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedServiceIdentityUserAssignedIdentities.java new file mode 100644 index 000000000000..9f88ee91642f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ManagedServiceIdentityUserAssignedIdentities.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.UUID; + +/** + * The ManagedServiceIdentityUserAssignedIdentities model. + */ +@Immutable +public final class ManagedServiceIdentityUserAssignedIdentities extends UserAssignedIdentity { + /* + * The client ID of the assigned identity. + */ + private UUID clientId; + + /* + * The principal ID of the assigned identity. + */ + private UUID principalId; + + /** + * Creates an instance of ManagedServiceIdentityUserAssignedIdentities class. + */ + public ManagedServiceIdentityUserAssignedIdentities() { + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + @Override + public UUID clientId() { + return this.clientId; + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + @Override + public UUID principalId() { + return this.principalId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentityUserAssignedIdentities from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentityUserAssignedIdentities 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 ManagedServiceIdentityUserAssignedIdentities. + */ + public static ManagedServiceIdentityUserAssignedIdentities fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentityUserAssignedIdentities deserializedManagedServiceIdentityUserAssignedIdentities + = new ManagedServiceIdentityUserAssignedIdentities(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentityUserAssignedIdentities.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("clientId".equals(fieldName)) { + deserializedManagedServiceIdentityUserAssignedIdentities.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentityUserAssignedIdentities; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MandatoryApprover.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MandatoryApprover.java new file mode 100644 index 000000000000..aef9b483138c --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/MandatoryApprover.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (approverEntraId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property approverEntraId in model MandatoryApprover")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MandatoryApprover.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Operation.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Operation.java new file mode 100644 index 000000000000..2ac71c406157 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.resourcemanager.mission.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 ARM/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: 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.mission.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/OperationDisplay.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/OperationDisplay.java new file mode 100644 index 000000000000..8fe6db6c2120 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 this particular 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. + */ + public 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/OperationListResult.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/OperationListResult.java new file mode 100644 index 000000000000..78c5be62a3bc --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/OperationListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.mission.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 { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + 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 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Operations.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Operations.java new file mode 100644 index 000000000000..56071a8e6dad --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Origin.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Origin.java new file mode 100644 index 000000000000..1410254bdca5 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Principal.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Principal.java new file mode 100644 index 000000000000..ed7f0a0cbe1b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Principal.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property id in model Principal")); + } + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model Principal")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Principal.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/PrincipalType.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/PrincipalType.java new file mode 100644 index 000000000000..80821195e97a --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/PrincipalType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the object id. We currently allow users, groups, and service principals. + */ +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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ProvisioningState.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ProvisioningState.java new file mode 100644 index 000000000000..e3b0c4a916d6 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ProvisioningState.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning status of the resource. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Accepted for ProvisioningState. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Static value Created for ProvisioningState. + */ + public static final ProvisioningState CREATED = fromString("Created"); + + /** + * Static value Creating for ProvisioningState. + */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** + * Static value Deleted for ProvisioningState. + */ + public static final ProvisioningState DELETED = fromString("Deleted"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value NotSpecified for ProvisioningState. + */ + public static final ProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** + * Static value Ready for ProvisioningState. + */ + public static final ProvisioningState READY = fromString("Ready"); + + /** + * Static value Running for ProvisioningState. + */ + public static final ProvisioningState RUNNING = fromString("Running"); + + /** + * Static value Updating for ProvisioningState. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/RequestMetadata.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/RequestMetadata.java new file mode 100644 index 000000000000..284911de026f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/RequestMetadata.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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; + + /* + * Approval status. + */ + private ApprovalStatus approvalStatus; + + /* + * Route name for the approval callback + */ + private String approvalCallbackRoute; + + /* + * Payload to be sent upon any action on approval request + */ + private String approvalCallbackPayload; + + /** + * 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 approvalStatus property: Approval status. + * + * @return the approvalStatus value. + */ + public ApprovalStatus approvalStatus() { + return this.approvalStatus; + } + + /** + * Set the approvalStatus property: Approval status. + * + * @param approvalStatus the approvalStatus value to set. + * @return the RequestMetadata object itself. + */ + public RequestMetadata withApprovalStatus(ApprovalStatus approvalStatus) { + this.approvalStatus = approvalStatus; + 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceAction() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property resourceAction in model RequestMetadata")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RequestMetadata.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceAction", this.resourceAction); + jsonWriter.writeStringField("approvalStatus", + this.approvalStatus == null ? null : this.approvalStatus.toString()); + jsonWriter.writeStringField("approvalCallbackRoute", this.approvalCallbackRoute); + jsonWriter.writeStringField("approvalCallbackPayload", this.approvalCallbackPayload); + 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 ("approvalStatus".equals(fieldName)) { + deserializedRequestMetadata.approvalStatus = ApprovalStatus.fromString(reader.getString()); + } else if ("approvalCallbackRoute".equals(fieldName)) { + deserializedRequestMetadata.approvalCallbackRoute = reader.getString(); + } else if ("approvalCallbackPayload".equals(fieldName)) { + deserializedRequestMetadata.approvalCallbackPayload = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRequestMetadata; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/RequestMetadataUpdate.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/RequestMetadataUpdate.java new file mode 100644 index 000000000000..0f91db45e71b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/RequestMetadataUpdate.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 RequestMetadataUpdate implements JsonSerializable { + /* + * Resource Action of the item being approved or declined. + */ + private String resourceAction; + + /* + * Approval status. + */ + private ApprovalStatus approvalStatus; + + /* + * Route name for the approval callback + */ + private String approvalCallbackRoute; + + /* + * Payload to be sent upon any action on approval request + */ + private String approvalCallbackPayload; + + /** + * Creates an instance of RequestMetadataUpdate class. + */ + public RequestMetadataUpdate() { + } + + /** + * 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 RequestMetadataUpdate object itself. + */ + public RequestMetadataUpdate withResourceAction(String resourceAction) { + this.resourceAction = resourceAction; + return this; + } + + /** + * Get the approvalStatus property: Approval status. + * + * @return the approvalStatus value. + */ + public ApprovalStatus approvalStatus() { + return this.approvalStatus; + } + + /** + * Set the approvalStatus property: Approval status. + * + * @param approvalStatus the approvalStatus value to set. + * @return the RequestMetadataUpdate object itself. + */ + public RequestMetadataUpdate withApprovalStatus(ApprovalStatus approvalStatus) { + this.approvalStatus = approvalStatus; + 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 RequestMetadataUpdate object itself. + */ + public RequestMetadataUpdate 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 RequestMetadataUpdate object itself. + */ + public RequestMetadataUpdate withApprovalCallbackPayload(String approvalCallbackPayload) { + this.approvalCallbackPayload = approvalCallbackPayload; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceAction", this.resourceAction); + jsonWriter.writeStringField("approvalStatus", + this.approvalStatus == null ? null : this.approvalStatus.toString()); + jsonWriter.writeStringField("approvalCallbackRoute", this.approvalCallbackRoute); + jsonWriter.writeStringField("approvalCallbackPayload", this.approvalCallbackPayload); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RequestMetadataUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RequestMetadataUpdate 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 RequestMetadataUpdate. + */ + public static RequestMetadataUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RequestMetadataUpdate deserializedRequestMetadataUpdate = new RequestMetadataUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceAction".equals(fieldName)) { + deserializedRequestMetadataUpdate.resourceAction = reader.getString(); + } else if ("approvalStatus".equals(fieldName)) { + deserializedRequestMetadataUpdate.approvalStatus = ApprovalStatus.fromString(reader.getString()); + } else if ("approvalCallbackRoute".equals(fieldName)) { + deserializedRequestMetadataUpdate.approvalCallbackRoute = reader.getString(); + } else if ("approvalCallbackPayload".equals(fieldName)) { + deserializedRequestMetadataUpdate.approvalCallbackPayload = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRequestMetadataUpdate; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/RoleAssignmentItem.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/RoleAssignmentItem.java new file mode 100644 index 000000000000..4d75e5d66a4f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/RoleAssignmentItem.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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 id; + + /* + * List of principal IDs to which to assign this role definition + */ + private List principals; + + /** + * Creates an instance of RoleAssignmentItem class. + */ + public RoleAssignmentItem() { + } + + /** + * Get the id property: Role definition identifier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Role definition identifier. + * + * @param id the id value to set. + * @return the RoleAssignmentItem object itself. + */ + public RoleAssignmentItem withId(String id) { + this.id = id; + 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property id in model RoleAssignmentItem")); + } + if (principals() != null) { + principals().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RoleAssignmentItem.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + 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 ("id".equals(fieldName)) { + deserializedRoleAssignmentItem.id = 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ServiceIdentifier.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ServiceIdentifier.java new file mode 100644 index 000000000000..ea9a136d3cc4 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/ServiceIdentifier.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Identifier for governed services. + */ +public final class ServiceIdentifier extends ExpandableStringEnum { + /** + * Static value AKS for ServiceIdentifier. + */ + public static final ServiceIdentifier AKS = fromString("AKS"); + + /** + * Static value AppService for ServiceIdentifier. + */ + public static final ServiceIdentifier APP_SERVICE = fromString("AppService"); + + /** + * Static value AzureFirewalls for ServiceIdentifier. + */ + public static final ServiceIdentifier AZURE_FIREWALLS = fromString("AzureFirewalls"); + + /** + * Static value ContainerRegistry for ServiceIdentifier. + */ + public static final ServiceIdentifier CONTAINER_REGISTRY = fromString("ContainerRegistry"); + + /** + * Static value CosmosDB for ServiceIdentifier. + */ + public static final ServiceIdentifier COSMOS_DB = fromString("CosmosDB"); + + /** + * Static value DataConnectors for ServiceIdentifier. + */ + public static final ServiceIdentifier DATA_CONNECTORS = fromString("DataConnectors"); + + /** + * Static value Insights for ServiceIdentifier. + */ + public static final ServiceIdentifier INSIGHTS = fromString("Insights"); + + /** + * Static value KeyVault for ServiceIdentifier. + */ + public static final ServiceIdentifier KEY_VAULT = fromString("KeyVault"); + + /** + * Static value Logic for ServiceIdentifier. + */ + public static final ServiceIdentifier LOGIC = fromString("Logic"); + + /** + * Static value MicrosoftSQL for ServiceIdentifier. + */ + public static final ServiceIdentifier MICROSOFT_SQL = fromString("MicrosoftSQL"); + + /** + * Static value Monitoring for ServiceIdentifier. + */ + public static final ServiceIdentifier MONITORING = fromString("Monitoring"); + + /** + * Static value PostgreSQL for ServiceIdentifier. + */ + public static final ServiceIdentifier POSTGRE_SQL = fromString("PostgreSQL"); + + /** + * Static value PrivateDNSZones for ServiceIdentifier. + */ + public static final ServiceIdentifier PRIVATE_DNSZONES = fromString("PrivateDNSZones"); + + /** + * Static value ServiceBus for ServiceIdentifier. + */ + public static final ServiceIdentifier SERVICE_BUS = fromString("ServiceBus"); + + /** + * Static value Storage for ServiceIdentifier. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/SubnetConfiguration.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/SubnetConfiguration.java new file mode 100644 index 000000000000..cd4c3841c4ca --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/SubnetConfiguration.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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 name; + + /* + * Subnet ID. + */ + private String id; + + /* + * Network prefix size. + */ + private int networkPrefixSize; + + /* + * Subnet delegation. + */ + private String subnetDelegation; + + /* + * Address prefix. + */ + private String addressPrefix; + + /* + * Network security group ID. + */ + private String networkSecurityGroupId; + + /** + * Creates an instance of SubnetConfiguration class. + */ + public SubnetConfiguration() { + } + + /** + * Get the name property: Subnet name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Subnet name. + * + * @param name the name value to set. + * @return the SubnetConfiguration object itself. + */ + public SubnetConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the id property: Subnet ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * 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 networkSecurityGroupId property: Network security group ID. + * + * @return the networkSecurityGroupId value. + */ + public String networkSecurityGroupId() { + return this.networkSecurityGroupId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model SubnetConfiguration")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SubnetConfiguration.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + 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 ("name".equals(fieldName)) { + deserializedSubnetConfiguration.name = reader.getString(); + } else if ("networkPrefixSize".equals(fieldName)) { + deserializedSubnetConfiguration.networkPrefixSize = reader.getInt(); + } else if ("id".equals(fieldName)) { + deserializedSubnetConfiguration.id = reader.getString(); + } else if ("subnetDelegation".equals(fieldName)) { + deserializedSubnetConfiguration.subnetDelegation = reader.getString(); + } else if ("addressPrefix".equals(fieldName)) { + deserializedSubnetConfiguration.addressPrefix = reader.getString(); + } else if ("networkSecurityGroupId".equals(fieldName)) { + deserializedSubnetConfiguration.networkSecurityGroupId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubnetConfiguration; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubPatchResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubPatchResource.java new file mode 100644 index 000000000000..2166437f2884 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubPatchResource.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 TransitHubPatchResource implements JsonSerializable { + /* + * The TransitHub resource. + */ + private UpdateTransitHubPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of TransitHubPatchResource class. + */ + public TransitHubPatchResource() { + } + + /** + * Get the properties property: The TransitHub resource. + * + * @return the properties value. + */ + public UpdateTransitHubPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The TransitHub resource. + * + * @param properties the properties value to set. + * @return the TransitHubPatchResource object itself. + */ + public TransitHubPatchResource withProperties(UpdateTransitHubPatchProperties 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 TransitHubPatchResource object itself. + */ + public TransitHubPatchResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@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 TransitHubPatchResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TransitHubPatchResource 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 TransitHubPatchResource. + */ + public static TransitHubPatchResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TransitHubPatchResource deserializedTransitHubPatchResource = new TransitHubPatchResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedTransitHubPatchResource.properties = UpdateTransitHubPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTransitHubPatchResource.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedTransitHubPatchResource; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubResource.java new file mode 100644 index 000000000000..d0b558807e51 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubResource.java @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.TransitHubResourceInner; +import java.util.List; +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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the state property: The state of the transitHub. + * + * @return the state value. + */ + TransitHubState state(); + + /** + * Gets the transitOption property: The TransitOption of the transitHub. + * + * @return the transitOption value. + */ + TransitOption transitOption(); + + /** + * Gets the resourceCollection property: List of resource ids modified by transitHubs. + * + * @return the resourceCollection value. + */ + List resourceCollection(); + + /** + * 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.mission.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.WithState, + DefinitionStages.WithTransitOption, DefinitionStages.WithResourceCollection { + /** + * 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 state. + */ + interface WithState { + /** + * Specifies the state property: The state of the transitHub.. + * + * @param state The state of the transitHub. + * @return the next definition stage. + */ + WithCreate withState(TransitHubState state); + } + + /** + * The stage of the TransitHubResource definition allowing to specify transitOption. + */ + interface WithTransitOption { + /** + * Specifies the transitOption property: The TransitOption of the transitHub.. + * + * @param transitOption The TransitOption of the transitHub. + * @return the next definition stage. + */ + WithCreate withTransitOption(TransitOption transitOption); + } + + /** + * The stage of the TransitHubResource definition allowing to specify resourceCollection. + */ + interface WithResourceCollection { + /** + * Specifies the resourceCollection property: List of resource ids modified by transitHubs.. + * + * @param resourceCollection List of resource ids modified by transitHubs. + * @return the next definition stage. + */ + WithCreate withResourceCollection(List resourceCollection); + } + } + + /** + * 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(UpdateTransitHubPatchProperties 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubResourceListResult.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubResourceListResult.java new file mode 100644 index 000000000000..f124837ca0ae --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubResourceListResult.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.fluent.models.TransitHubResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a TransitHubResource list operation. + */ +@Fluent +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. + */ + public TransitHubResourceListResult() { + } + + /** + * Get the value property: The TransitHubResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The TransitHubResource items on this page. + * + * @param value the value value to set. + * @return the TransitHubResourceListResult object itself. + */ + public TransitHubResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the TransitHubResourceListResult object itself. + */ + public TransitHubResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model TransitHubResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TransitHubResourceListResult.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubState.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubState.java new file mode 100644 index 000000000000..2644ceee077a --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubState.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the state of the transitHub. + */ +public final class TransitHubState extends ExpandableStringEnum { + /** + * Static value PendingApproval for TransitHubState. + */ + public static final TransitHubState PENDING_APPROVAL = fromString("PendingApproval"); + + /** + * Static value Approved for TransitHubState. + */ + public static final TransitHubState APPROVED = fromString("Approved"); + + /** + * Static value PendingUpdate for TransitHubState. + */ + public static final TransitHubState PENDING_UPDATE = fromString("PendingUpdate"); + + /** + * Static value Active for TransitHubState. + */ + public static final TransitHubState ACTIVE = fromString("Active"); + + /** + * Static value Failed for TransitHubState. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubs.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubs.java new file mode 100644 index 000000000000..43d36cb60170 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitHubs.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitOption.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitOption.java new file mode 100644 index 000000000000..c45758fee00f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitOption.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (params() != null) { + params().validate(); + } + } + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitOptionParams.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitOptionParams.java new file mode 100644 index 000000000000..030f17d83e97 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitOptionParams.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitOptionType.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitOptionType.java new file mode 100644 index 000000000000..b3f268655c30 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/TransitOptionType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the type of the transitOption. + */ +public final class TransitOptionType extends ExpandableStringEnum { + /** + * Static value ExpressRoute for TransitOptionType. + */ + public static final TransitOptionType EXPRESS_ROUTE = fromString("ExpressRoute"); + + /** + * Static value Gateway for TransitOptionType. + */ + public static final TransitOptionType GATEWAY = fromString("Gateway"); + + /** + * Static value Peering for TransitOptionType. + */ + 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateApprovalProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateApprovalProperties.java new file mode 100644 index 000000000000..3b587a421273 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateApprovalProperties.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + +/** + * A copy of the input model `T` with only the properties that are visible during the + * "Update" resource lifecycle phase. + * + * The "Update" lifecycle phase is used for properties passed as parameters to operations + * that update data, like HTTP PATCH operations. + * + * This transformation will include only the properties that have the `Lifecycle.Update` + * visibility modifier, and the types of all properties will be replaced with the + * equivalent `CreateOrUpdate` transformation. + * + * If a `NameTemplate` is provided, the new model will be named according to the template. + * The template uses the same syntax as the `@friendlyName` decorator. + */ +@Fluent +public final class UpdateApprovalProperties implements JsonSerializable { + /* + * Parameter for optimizing query results + */ + private String parent1; + + /* + * Parameter for optimizing query results + */ + private String parent2; + + /* + * Request metadata for the approval request. + */ + private RequestMetadataUpdate requestMetadata; + + /* + * 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; + + /** + * Creates an instance of UpdateApprovalProperties class. + */ + public UpdateApprovalProperties() { + } + + /** + * Get the parent1 property: Parameter for optimizing query results. + * + * @return the parent1 value. + */ + public String parent1() { + return this.parent1; + } + + /** + * Set the parent1 property: Parameter for optimizing query results. + * + * @param parent1 the parent1 value to set. + * @return the UpdateApprovalProperties object itself. + */ + public UpdateApprovalProperties withParent1(String parent1) { + this.parent1 = parent1; + return this; + } + + /** + * Get the parent2 property: Parameter for optimizing query results. + * + * @return the parent2 value. + */ + public String parent2() { + return this.parent2; + } + + /** + * Set the parent2 property: Parameter for optimizing query results. + * + * @param parent2 the parent2 value to set. + * @return the UpdateApprovalProperties object itself. + */ + public UpdateApprovalProperties withParent2(String parent2) { + this.parent2 = parent2; + return this; + } + + /** + * Get the requestMetadata property: Request metadata for the approval request. + * + * @return the requestMetadata value. + */ + public RequestMetadataUpdate requestMetadata() { + return this.requestMetadata; + } + + /** + * Set the requestMetadata property: Request metadata for the approval request. + * + * @param requestMetadata the requestMetadata value to set. + * @return the UpdateApprovalProperties object itself. + */ + public UpdateApprovalProperties withRequestMetadata(RequestMetadataUpdate requestMetadata) { + this.requestMetadata = requestMetadata; + 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 UpdateApprovalProperties object itself. + */ + public UpdateApprovalProperties 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 UpdateApprovalProperties object itself. + */ + public UpdateApprovalProperties 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 UpdateApprovalProperties object itself. + */ + public UpdateApprovalProperties 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 UpdateApprovalProperties object itself. + */ + public UpdateApprovalProperties withStateChangedAt(OffsetDateTime stateChangedAt) { + this.stateChangedAt = stateChangedAt; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (requestMetadata() != null) { + requestMetadata().validate(); + } + if (approvers() != null) { + approvers().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("parent1", this.parent1); + jsonWriter.writeStringField("parent2", this.parent2); + jsonWriter.writeJsonField("requestMetadata", this.requestMetadata); + 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 UpdateApprovalProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateApprovalProperties 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 UpdateApprovalProperties. + */ + public static UpdateApprovalProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateApprovalProperties deserializedUpdateApprovalProperties = new UpdateApprovalProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("parent1".equals(fieldName)) { + deserializedUpdateApprovalProperties.parent1 = reader.getString(); + } else if ("parent2".equals(fieldName)) { + deserializedUpdateApprovalProperties.parent2 = reader.getString(); + } else if ("requestMetadata".equals(fieldName)) { + deserializedUpdateApprovalProperties.requestMetadata = RequestMetadataUpdate.fromJson(reader); + } else if ("approvers".equals(fieldName)) { + List approvers = reader.readArray(reader1 -> Approver.fromJson(reader1)); + deserializedUpdateApprovalProperties.approvers = approvers; + } else if ("ticketId".equals(fieldName)) { + deserializedUpdateApprovalProperties.ticketId = reader.getString(); + } else if ("createdAt".equals(fieldName)) { + deserializedUpdateApprovalProperties.createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("stateChangedAt".equals(fieldName)) { + deserializedUpdateApprovalProperties.stateChangedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateApprovalProperties; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateCommunityEndpointPatchProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateCommunityEndpointPatchProperties.java new file mode 100644 index 000000000000..f2a9f435641d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateCommunityEndpointPatchProperties.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + +/** + * A copy of the input model `T` with only the properties that are visible during the + * "Update" resource lifecycle phase. + * + * The "Update" lifecycle phase is used for properties passed as parameters to operations + * that update data, like HTTP PATCH operations. + * + * This transformation will include only the properties that have the `Lifecycle.Update` + * visibility modifier, and the types of all properties will be replaced with the + * equivalent `CreateOrUpdate` transformation. + * + * If a `NameTemplate` is provided, the new model will be named according to the template. + * The template uses the same syntax as the `@friendlyName` decorator. + */ +@Fluent +public final class UpdateCommunityEndpointPatchProperties + implements JsonSerializable { + /* + * Community Endpoint Rule Collection. + */ + private List ruleCollection; + + /* + * List of resource ids created by community endpoint. + */ + private List resourceCollection; + + /** + * Creates an instance of UpdateCommunityEndpointPatchProperties class. + */ + public UpdateCommunityEndpointPatchProperties() { + } + + /** + * 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 UpdateCommunityEndpointPatchProperties object itself. + */ + public UpdateCommunityEndpointPatchProperties + 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; + } + + /** + * Set the resourceCollection property: List of resource ids created by community endpoint. + * + * @param resourceCollection the resourceCollection value to set. + * @return the UpdateCommunityEndpointPatchProperties object itself. + */ + public UpdateCommunityEndpointPatchProperties withResourceCollection(List resourceCollection) { + this.resourceCollection = resourceCollection; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ruleCollection() != null) { + ruleCollection().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ruleCollection", this.ruleCollection, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("resourceCollection", this.resourceCollection, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateCommunityEndpointPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateCommunityEndpointPatchProperties 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 UpdateCommunityEndpointPatchProperties. + */ + public static UpdateCommunityEndpointPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateCommunityEndpointPatchProperties deserializedUpdateCommunityEndpointPatchProperties + = new UpdateCommunityEndpointPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ruleCollection".equals(fieldName)) { + List ruleCollection + = reader.readArray(reader1 -> CommunityEndpointDestinationRule.fromJson(reader1)); + deserializedUpdateCommunityEndpointPatchProperties.ruleCollection = ruleCollection; + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedUpdateCommunityEndpointPatchProperties.resourceCollection = resourceCollection; + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateCommunityEndpointPatchProperties; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateCommunityPatchProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateCommunityPatchProperties.java new file mode 100644 index 000000000000..e499955bc2da --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateCommunityPatchProperties.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + +/** + * A copy of the input model `T` with only the properties that are visible during the + * "Update" resource lifecycle phase. + * + * The "Update" lifecycle phase is used for properties passed as parameters to operations + * that update data, like HTTP PATCH operations. + * + * This transformation will include only the properties that have the `Lifecycle.Update` + * visibility modifier, and the types of all properties will be replaced with the + * equivalent `CreateOrUpdate` transformation. + * + * If a `NameTemplate` is provided, the new model will be named according to the template. + * The template uses the same syntax as the `@friendlyName` decorator. + */ +@Fluent +public final class UpdateCommunityPatchProperties implements JsonSerializable { + /* + * Address Space. + */ + private String addressSpace; + + /* + * Dns Servers. + */ + private List dnsServers; + + /* + * Managed resource group configuration. + */ + private ManagedResourceGroupConfiguration managedResourceGroupConfiguration; + + /* + * List of services governed by a community. + */ + private List governedServiceList; + + /* + * Community role assignments + */ + private List communityRoleAssignments; + + /* + * Approval requirements for various actions on the community's resources. + */ + private ApprovalSettings approvalSettings; + + /* + * Maintenance Mode configuration. + */ + private MaintenanceModeConfigurationUpdate maintenanceModeConfiguration; + + /** + * Creates an instance of UpdateCommunityPatchProperties class. + */ + public UpdateCommunityPatchProperties() { + } + + /** + * 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 UpdateCommunityPatchProperties object itself. + */ + public UpdateCommunityPatchProperties 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 UpdateCommunityPatchProperties object itself. + */ + public UpdateCommunityPatchProperties withDnsServers(List dnsServers) { + this.dnsServers = dnsServers; + return this; + } + + /** + * Get the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @return the managedResourceGroupConfiguration value. + */ + public ManagedResourceGroupConfiguration managedResourceGroupConfiguration() { + return this.managedResourceGroupConfiguration; + } + + /** + * Set the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @param managedResourceGroupConfiguration the managedResourceGroupConfiguration value to set. + * @return the UpdateCommunityPatchProperties object itself. + */ + public UpdateCommunityPatchProperties + withManagedResourceGroupConfiguration(ManagedResourceGroupConfiguration managedResourceGroupConfiguration) { + this.managedResourceGroupConfiguration = managedResourceGroupConfiguration; + 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 UpdateCommunityPatchProperties object itself. + */ + public UpdateCommunityPatchProperties withGovernedServiceList(List governedServiceList) { + this.governedServiceList = governedServiceList; + 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 UpdateCommunityPatchProperties object itself. + */ + public UpdateCommunityPatchProperties + withCommunityRoleAssignments(List communityRoleAssignments) { + this.communityRoleAssignments = communityRoleAssignments; + 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 UpdateCommunityPatchProperties object itself. + */ + public UpdateCommunityPatchProperties withApprovalSettings(ApprovalSettings approvalSettings) { + this.approvalSettings = approvalSettings; + return this; + } + + /** + * Get the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @return the maintenanceModeConfiguration value. + */ + public MaintenanceModeConfigurationUpdate maintenanceModeConfiguration() { + return this.maintenanceModeConfiguration; + } + + /** + * Set the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @param maintenanceModeConfiguration the maintenanceModeConfiguration value to set. + * @return the UpdateCommunityPatchProperties object itself. + */ + public UpdateCommunityPatchProperties + withMaintenanceModeConfiguration(MaintenanceModeConfigurationUpdate maintenanceModeConfiguration) { + this.maintenanceModeConfiguration = maintenanceModeConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (managedResourceGroupConfiguration() != null) { + managedResourceGroupConfiguration().validate(); + } + if (governedServiceList() != null) { + governedServiceList().forEach(e -> e.validate()); + } + if (communityRoleAssignments() != null) { + communityRoleAssignments().forEach(e -> e.validate()); + } + if (approvalSettings() != null) { + approvalSettings().validate(); + } + if (maintenanceModeConfiguration() != null) { + maintenanceModeConfiguration().validate(); + } + } + + /** + * {@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.writeJsonField("managedResourceGroupConfiguration", this.managedResourceGroupConfiguration); + jsonWriter.writeArrayField("governedServiceList", this.governedServiceList, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("communityRoleAssignments", this.communityRoleAssignments, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("approvalSettings", this.approvalSettings); + jsonWriter.writeJsonField("maintenanceModeConfiguration", this.maintenanceModeConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateCommunityPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateCommunityPatchProperties 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 UpdateCommunityPatchProperties. + */ + public static UpdateCommunityPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateCommunityPatchProperties deserializedUpdateCommunityPatchProperties + = new UpdateCommunityPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("addressSpace".equals(fieldName)) { + deserializedUpdateCommunityPatchProperties.addressSpace = reader.getString(); + } else if ("dnsServers".equals(fieldName)) { + List dnsServers = reader.readArray(reader1 -> reader1.getString()); + deserializedUpdateCommunityPatchProperties.dnsServers = dnsServers; + } else if ("managedResourceGroupConfiguration".equals(fieldName)) { + deserializedUpdateCommunityPatchProperties.managedResourceGroupConfiguration + = ManagedResourceGroupConfiguration.fromJson(reader); + } else if ("governedServiceList".equals(fieldName)) { + List governedServiceList + = reader.readArray(reader1 -> GovernedServiceItem.fromJson(reader1)); + deserializedUpdateCommunityPatchProperties.governedServiceList = governedServiceList; + } else if ("communityRoleAssignments".equals(fieldName)) { + List communityRoleAssignments + = reader.readArray(reader1 -> RoleAssignmentItem.fromJson(reader1)); + deserializedUpdateCommunityPatchProperties.communityRoleAssignments = communityRoleAssignments; + } else if ("approvalSettings".equals(fieldName)) { + deserializedUpdateCommunityPatchProperties.approvalSettings = ApprovalSettings.fromJson(reader); + } else if ("maintenanceModeConfiguration".equals(fieldName)) { + deserializedUpdateCommunityPatchProperties.maintenanceModeConfiguration + = MaintenanceModeConfigurationUpdate.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateCommunityPatchProperties; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateEnclaveConnectionPatchProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateEnclaveConnectionPatchProperties.java new file mode 100644 index 000000000000..e04c82cf31cf --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateEnclaveConnectionPatchProperties.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + +/** + * A copy of the input model `T` with only the properties that are visible during the + * "Update" resource lifecycle phase. + * + * The "Update" lifecycle phase is used for properties passed as parameters to operations + * that update data, like HTTP PATCH operations. + * + * This transformation will include only the properties that have the `Lifecycle.Update` + * visibility modifier, and the types of all properties will be replaced with the + * equivalent `CreateOrUpdate` transformation. + * + * If a `NameTemplate` is provided, the new model will be named according to the template. + * The template uses the same syntax as the `@friendlyName` decorator. + */ +@Fluent +public final class UpdateEnclaveConnectionPatchProperties + 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; + + /* + * Source IP group Resource Id. + */ + private String ipGroup; + + /* + * Destination Endpoint Resource Id. + */ + private String destinationEndpointId; + + /* + * List of resource ids modified by enclave Connections. + */ + private List resourceCollection; + + /** + * Creates an instance of UpdateEnclaveConnectionPatchProperties class. + */ + public UpdateEnclaveConnectionPatchProperties() { + } + + /** + * Get the state property: The state of the enclaveConnection. + * + * @return the state value. + */ + public EnclaveConnectionState state() { + return this.state; + } + + /** + * Set the state property: The state of the enclaveConnection. + * + * @param state the state value to set. + * @return the UpdateEnclaveConnectionPatchProperties object itself. + */ + public UpdateEnclaveConnectionPatchProperties withState(EnclaveConnectionState state) { + this.state = state; + return this; + } + + /** + * 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 UpdateEnclaveConnectionPatchProperties object itself. + */ + public UpdateEnclaveConnectionPatchProperties 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 UpdateEnclaveConnectionPatchProperties object itself. + */ + public UpdateEnclaveConnectionPatchProperties 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 UpdateEnclaveConnectionPatchProperties object itself. + */ + public UpdateEnclaveConnectionPatchProperties withSourceCidr(String sourceCidr) { + this.sourceCidr = sourceCidr; + return this; + } + + /** + * Get the ipGroup property: Source IP group Resource Id. + * + * @return the ipGroup value. + */ + public String ipGroup() { + return this.ipGroup; + } + + /** + * Set the ipGroup property: Source IP group Resource Id. + * + * @param ipGroup the ipGroup value to set. + * @return the UpdateEnclaveConnectionPatchProperties object itself. + */ + public UpdateEnclaveConnectionPatchProperties withIpGroup(String ipGroup) { + this.ipGroup = ipGroup; + 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 UpdateEnclaveConnectionPatchProperties object itself. + */ + public UpdateEnclaveConnectionPatchProperties withDestinationEndpointId(String destinationEndpointId) { + this.destinationEndpointId = destinationEndpointId; + return this; + } + + /** + * Get the resourceCollection property: List of resource ids modified by enclave Connections. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.resourceCollection; + } + + /** + * Set the resourceCollection property: List of resource ids modified by enclave Connections. + * + * @param resourceCollection the resourceCollection value to set. + * @return the UpdateEnclaveConnectionPatchProperties object itself. + */ + public UpdateEnclaveConnectionPatchProperties withResourceCollection(List resourceCollection) { + this.resourceCollection = resourceCollection; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeStringField("communityResourceId", this.communityResourceId); + jsonWriter.writeStringField("sourceResourceId", this.sourceResourceId); + jsonWriter.writeStringField("sourceCidr", this.sourceCidr); + jsonWriter.writeStringField("ipGroup", this.ipGroup); + jsonWriter.writeStringField("destinationEndpointId", this.destinationEndpointId); + jsonWriter.writeArrayField("resourceCollection", this.resourceCollection, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateEnclaveConnectionPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateEnclaveConnectionPatchProperties 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 UpdateEnclaveConnectionPatchProperties. + */ + public static UpdateEnclaveConnectionPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateEnclaveConnectionPatchProperties deserializedUpdateEnclaveConnectionPatchProperties + = new UpdateEnclaveConnectionPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedUpdateEnclaveConnectionPatchProperties.state + = EnclaveConnectionState.fromString(reader.getString()); + } else if ("communityResourceId".equals(fieldName)) { + deserializedUpdateEnclaveConnectionPatchProperties.communityResourceId = reader.getString(); + } else if ("sourceResourceId".equals(fieldName)) { + deserializedUpdateEnclaveConnectionPatchProperties.sourceResourceId = reader.getString(); + } else if ("sourceCidr".equals(fieldName)) { + deserializedUpdateEnclaveConnectionPatchProperties.sourceCidr = reader.getString(); + } else if ("ipGroup".equals(fieldName)) { + deserializedUpdateEnclaveConnectionPatchProperties.ipGroup = reader.getString(); + } else if ("destinationEndpointId".equals(fieldName)) { + deserializedUpdateEnclaveConnectionPatchProperties.destinationEndpointId = reader.getString(); + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedUpdateEnclaveConnectionPatchProperties.resourceCollection = resourceCollection; + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateEnclaveConnectionPatchProperties; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateEnclaveEndpointPatchProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateEnclaveEndpointPatchProperties.java new file mode 100644 index 000000000000..335a49b1c0ac --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateEnclaveEndpointPatchProperties.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + +/** + * A copy of the input model `T` with only the properties that are visible during the + * "Update" resource lifecycle phase. + * + * The "Update" lifecycle phase is used for properties passed as parameters to operations + * that update data, like HTTP PATCH operations. + * + * This transformation will include only the properties that have the `Lifecycle.Update` + * visibility modifier, and the types of all properties will be replaced with the + * equivalent `CreateOrUpdate` transformation. + * + * If a `NameTemplate` is provided, the new model will be named according to the template. + * The template uses the same syntax as the `@friendlyName` decorator. + */ +@Fluent +public final class UpdateEnclaveEndpointPatchProperties + implements JsonSerializable { + /* + * Enclave Endpoint Rule Collection. + */ + private List ruleCollection; + + /* + * List of resource ids created by community endpoint. + */ + private List resourceCollection; + + /** + * Creates an instance of UpdateEnclaveEndpointPatchProperties class. + */ + public UpdateEnclaveEndpointPatchProperties() { + } + + /** + * 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 UpdateEnclaveEndpointPatchProperties object itself. + */ + public UpdateEnclaveEndpointPatchProperties + 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; + } + + /** + * Set the resourceCollection property: List of resource ids created by community endpoint. + * + * @param resourceCollection the resourceCollection value to set. + * @return the UpdateEnclaveEndpointPatchProperties object itself. + */ + public UpdateEnclaveEndpointPatchProperties withResourceCollection(List resourceCollection) { + this.resourceCollection = resourceCollection; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ruleCollection() != null) { + ruleCollection().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ruleCollection", this.ruleCollection, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("resourceCollection", this.resourceCollection, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateEnclaveEndpointPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateEnclaveEndpointPatchProperties 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 UpdateEnclaveEndpointPatchProperties. + */ + public static UpdateEnclaveEndpointPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateEnclaveEndpointPatchProperties deserializedUpdateEnclaveEndpointPatchProperties + = new UpdateEnclaveEndpointPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ruleCollection".equals(fieldName)) { + List ruleCollection + = reader.readArray(reader1 -> EnclaveEndpointDestinationRule.fromJson(reader1)); + deserializedUpdateEnclaveEndpointPatchProperties.ruleCollection = ruleCollection; + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedUpdateEnclaveEndpointPatchProperties.resourceCollection = resourceCollection; + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateEnclaveEndpointPatchProperties; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateTransitHubPatchProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateTransitHubPatchProperties.java new file mode 100644 index 000000000000..35600e51ad25 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateTransitHubPatchProperties.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + +/** + * A copy of the input model `T` with only the properties that are visible during the + * "Update" resource lifecycle phase. + * + * The "Update" lifecycle phase is used for properties passed as parameters to operations + * that update data, like HTTP PATCH operations. + * + * This transformation will include only the properties that have the `Lifecycle.Update` + * visibility modifier, and the types of all properties will be replaced with the + * equivalent `CreateOrUpdate` transformation. + * + * If a `NameTemplate` is provided, the new model will be named according to the template. + * The template uses the same syntax as the `@friendlyName` decorator. + */ +@Fluent +public final class UpdateTransitHubPatchProperties 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 UpdateTransitHubPatchProperties class. + */ + public UpdateTransitHubPatchProperties() { + } + + /** + * 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 UpdateTransitHubPatchProperties object itself. + */ + public UpdateTransitHubPatchProperties 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 UpdateTransitHubPatchProperties object itself. + */ + public UpdateTransitHubPatchProperties 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; + } + + /** + * Set the resourceCollection property: List of resource ids modified by transitHubs. + * + * @param resourceCollection the resourceCollection value to set. + * @return the UpdateTransitHubPatchProperties object itself. + */ + public UpdateTransitHubPatchProperties withResourceCollection(List resourceCollection) { + this.resourceCollection = resourceCollection; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (transitOption() != null) { + transitOption().validate(); + } + } + + /** + * {@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); + jsonWriter.writeArrayField("resourceCollection", this.resourceCollection, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateTransitHubPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateTransitHubPatchProperties 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 UpdateTransitHubPatchProperties. + */ + public static UpdateTransitHubPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateTransitHubPatchProperties deserializedUpdateTransitHubPatchProperties + = new UpdateTransitHubPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedUpdateTransitHubPatchProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("state".equals(fieldName)) { + deserializedUpdateTransitHubPatchProperties.state = TransitHubState.fromString(reader.getString()); + } else if ("transitOption".equals(fieldName)) { + deserializedUpdateTransitHubPatchProperties.transitOption = TransitOption.fromJson(reader); + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedUpdateTransitHubPatchProperties.resourceCollection = resourceCollection; + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateTransitHubPatchProperties; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateVirtualEnclavePatchProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateVirtualEnclavePatchProperties.java new file mode 100644 index 000000000000..42b400a7f01d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateVirtualEnclavePatchProperties.java @@ -0,0 +1,367 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + +/** + * A copy of the input model `T` with only the properties that are visible during the + * "Update" resource lifecycle phase. + * + * The "Update" lifecycle phase is used for properties passed as parameters to operations + * that update data, like HTTP PATCH operations. + * + * This transformation will include only the properties that have the `Lifecycle.Update` + * visibility modifier, and the types of all properties will be replaced with the + * equivalent `CreateOrUpdate` transformation. + * + * If a `NameTemplate` is provided, the new model will be named according to the template. + * The template uses the same syntax as the `@friendlyName` decorator. + */ +@Fluent +public final class UpdateVirtualEnclavePatchProperties + implements JsonSerializable { + /* + * Virtual Network. + */ + private EnclaveVirtualNetwork enclaveVirtualNetwork; + + /* + * Community Resource Id. + */ + private String communityResourceId; + + /* + * Default Settings + */ + private EnclaveDefaultSettings enclaveDefaultSettings; + + /* + * List of resource ids created by Virtual Enclave. + */ + private List resourceCollection; + + /* + * Managed resource group configuration. + */ + private ManagedResourceGroupConfiguration managedResourceGroupConfiguration; + + /* + * Maintenance Mode configuration. + */ + private MaintenanceModeConfigurationUpdate maintenanceModeConfiguration; + + /* + * Deploy Bastion service (True or False). + */ + private Boolean bastionEnabled; + + /* + * Enclave role assignments + */ + private List enclaveRoleAssignments; + + /* + * Workload role assignments + */ + private List workloadRoleAssignments; + + /** + * Creates an instance of UpdateVirtualEnclavePatchProperties class. + */ + public UpdateVirtualEnclavePatchProperties() { + } + + /** + * Get the enclaveVirtualNetwork property: Virtual Network. + * + * @return the enclaveVirtualNetwork value. + */ + public EnclaveVirtualNetwork enclaveVirtualNetwork() { + return this.enclaveVirtualNetwork; + } + + /** + * Set the enclaveVirtualNetwork property: Virtual Network. + * + * @param enclaveVirtualNetwork the enclaveVirtualNetwork value to set. + * @return the UpdateVirtualEnclavePatchProperties object itself. + */ + public UpdateVirtualEnclavePatchProperties withEnclaveVirtualNetwork(EnclaveVirtualNetwork enclaveVirtualNetwork) { + this.enclaveVirtualNetwork = enclaveVirtualNetwork; + return this; + } + + /** + * 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 UpdateVirtualEnclavePatchProperties object itself. + */ + public UpdateVirtualEnclavePatchProperties withCommunityResourceId(String communityResourceId) { + this.communityResourceId = communityResourceId; + return this; + } + + /** + * Get the enclaveDefaultSettings property: Default Settings. + * + * @return the enclaveDefaultSettings value. + */ + public EnclaveDefaultSettings enclaveDefaultSettings() { + return this.enclaveDefaultSettings; + } + + /** + * Set the enclaveDefaultSettings property: Default Settings. + * + * @param enclaveDefaultSettings the enclaveDefaultSettings value to set. + * @return the UpdateVirtualEnclavePatchProperties object itself. + */ + public UpdateVirtualEnclavePatchProperties + withEnclaveDefaultSettings(EnclaveDefaultSettings enclaveDefaultSettings) { + this.enclaveDefaultSettings = enclaveDefaultSettings; + return this; + } + + /** + * Get the resourceCollection property: List of resource ids created by Virtual Enclave. + * + * @return the resourceCollection value. + */ + public List resourceCollection() { + return this.resourceCollection; + } + + /** + * Set the resourceCollection property: List of resource ids created by Virtual Enclave. + * + * @param resourceCollection the resourceCollection value to set. + * @return the UpdateVirtualEnclavePatchProperties object itself. + */ + public UpdateVirtualEnclavePatchProperties withResourceCollection(List resourceCollection) { + this.resourceCollection = resourceCollection; + return this; + } + + /** + * Get the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @return the managedResourceGroupConfiguration value. + */ + public ManagedResourceGroupConfiguration managedResourceGroupConfiguration() { + return this.managedResourceGroupConfiguration; + } + + /** + * Set the managedResourceGroupConfiguration property: Managed resource group configuration. + * + * @param managedResourceGroupConfiguration the managedResourceGroupConfiguration value to set. + * @return the UpdateVirtualEnclavePatchProperties object itself. + */ + public UpdateVirtualEnclavePatchProperties + withManagedResourceGroupConfiguration(ManagedResourceGroupConfiguration managedResourceGroupConfiguration) { + this.managedResourceGroupConfiguration = managedResourceGroupConfiguration; + return this; + } + + /** + * Get the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @return the maintenanceModeConfiguration value. + */ + public MaintenanceModeConfigurationUpdate maintenanceModeConfiguration() { + return this.maintenanceModeConfiguration; + } + + /** + * Set the maintenanceModeConfiguration property: Maintenance Mode configuration. + * + * @param maintenanceModeConfiguration the maintenanceModeConfiguration value to set. + * @return the UpdateVirtualEnclavePatchProperties object itself. + */ + public UpdateVirtualEnclavePatchProperties + withMaintenanceModeConfiguration(MaintenanceModeConfigurationUpdate maintenanceModeConfiguration) { + this.maintenanceModeConfiguration = maintenanceModeConfiguration; + 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 UpdateVirtualEnclavePatchProperties object itself. + */ + public UpdateVirtualEnclavePatchProperties 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 UpdateVirtualEnclavePatchProperties object itself. + */ + public UpdateVirtualEnclavePatchProperties + 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 UpdateVirtualEnclavePatchProperties object itself. + */ + public UpdateVirtualEnclavePatchProperties + withWorkloadRoleAssignments(List workloadRoleAssignments) { + this.workloadRoleAssignments = workloadRoleAssignments; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (enclaveVirtualNetwork() != null) { + enclaveVirtualNetwork().validate(); + } + if (enclaveDefaultSettings() != null) { + enclaveDefaultSettings().validate(); + } + if (managedResourceGroupConfiguration() != null) { + managedResourceGroupConfiguration().validate(); + } + if (maintenanceModeConfiguration() != null) { + maintenanceModeConfiguration().validate(); + } + if (enclaveRoleAssignments() != null) { + enclaveRoleAssignments().forEach(e -> e.validate()); + } + if (workloadRoleAssignments() != null) { + workloadRoleAssignments().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("enclaveVirtualNetwork", this.enclaveVirtualNetwork); + jsonWriter.writeStringField("communityResourceId", this.communityResourceId); + jsonWriter.writeJsonField("enclaveDefaultSettings", this.enclaveDefaultSettings); + jsonWriter.writeArrayField("resourceCollection", this.resourceCollection, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("managedResourceGroupConfiguration", this.managedResourceGroupConfiguration); + jsonWriter.writeJsonField("maintenanceModeConfiguration", this.maintenanceModeConfiguration); + 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)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UpdateVirtualEnclavePatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateVirtualEnclavePatchProperties 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 UpdateVirtualEnclavePatchProperties. + */ + public static UpdateVirtualEnclavePatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateVirtualEnclavePatchProperties deserializedUpdateVirtualEnclavePatchProperties + = new UpdateVirtualEnclavePatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enclaveVirtualNetwork".equals(fieldName)) { + deserializedUpdateVirtualEnclavePatchProperties.enclaveVirtualNetwork + = EnclaveVirtualNetwork.fromJson(reader); + } else if ("communityResourceId".equals(fieldName)) { + deserializedUpdateVirtualEnclavePatchProperties.communityResourceId = reader.getString(); + } else if ("enclaveDefaultSettings".equals(fieldName)) { + deserializedUpdateVirtualEnclavePatchProperties.enclaveDefaultSettings + = EnclaveDefaultSettings.fromJson(reader); + } else if ("resourceCollection".equals(fieldName)) { + List resourceCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedUpdateVirtualEnclavePatchProperties.resourceCollection = resourceCollection; + } else if ("managedResourceGroupConfiguration".equals(fieldName)) { + deserializedUpdateVirtualEnclavePatchProperties.managedResourceGroupConfiguration + = ManagedResourceGroupConfiguration.fromJson(reader); + } else if ("maintenanceModeConfiguration".equals(fieldName)) { + deserializedUpdateVirtualEnclavePatchProperties.maintenanceModeConfiguration + = MaintenanceModeConfigurationUpdate.fromJson(reader); + } else if ("bastionEnabled".equals(fieldName)) { + deserializedUpdateVirtualEnclavePatchProperties.bastionEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("enclaveRoleAssignments".equals(fieldName)) { + List enclaveRoleAssignments + = reader.readArray(reader1 -> RoleAssignmentItem.fromJson(reader1)); + deserializedUpdateVirtualEnclavePatchProperties.enclaveRoleAssignments = enclaveRoleAssignments; + } else if ("workloadRoleAssignments".equals(fieldName)) { + List workloadRoleAssignments + = reader.readArray(reader1 -> RoleAssignmentItem.fromJson(reader1)); + deserializedUpdateVirtualEnclavePatchProperties.workloadRoleAssignments = workloadRoleAssignments; + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateVirtualEnclavePatchProperties; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateWorkloadPatchProperties.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateWorkloadPatchProperties.java new file mode 100644 index 000000000000..f1f918387908 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UpdateWorkloadPatchProperties.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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; + +/** + * A copy of the input model `T` with only the properties that are visible during the + * "Update" resource lifecycle phase. + * + * The "Update" lifecycle phase is used for properties passed as parameters to operations + * that update data, like HTTP PATCH operations. + * + * This transformation will include only the properties that have the `Lifecycle.Update` + * visibility modifier, and the types of all properties will be replaced with the + * equivalent `CreateOrUpdate` transformation. + * + * If a `NameTemplate` is provided, the new model will be named according to the template. + * The template uses the same syntax as the `@friendlyName` decorator. + */ +@Fluent +public final class UpdateWorkloadPatchProperties implements JsonSerializable { + /* + * Provisioning State. + */ + private ProvisioningState provisioningState; + + /* + * List of resource group ids. + */ + private List resourceGroupCollection; + + /** + * Creates an instance of UpdateWorkloadPatchProperties class. + */ + public UpdateWorkloadPatchProperties() { + } + + /** + * 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 UpdateWorkloadPatchProperties object itself. + */ + public UpdateWorkloadPatchProperties withResourceGroupCollection(List resourceGroupCollection) { + this.resourceGroupCollection = resourceGroupCollection; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@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 UpdateWorkloadPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UpdateWorkloadPatchProperties 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 UpdateWorkloadPatchProperties. + */ + public static UpdateWorkloadPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UpdateWorkloadPatchProperties deserializedUpdateWorkloadPatchProperties + = new UpdateWorkloadPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedUpdateWorkloadPatchProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("resourceGroupCollection".equals(fieldName)) { + List resourceGroupCollection = reader.readArray(reader1 -> reader1.getString()); + deserializedUpdateWorkloadPatchProperties.resourceGroupCollection = resourceGroupCollection; + } else { + reader.skipChildren(); + } + } + + return deserializedUpdateWorkloadPatchProperties; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UserAssignedIdentity.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..70ae1eefe641 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/UserAssignedIdentity.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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.UUID; + +/** + * User assigned identity properties. + */ +@Immutable +public class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + private UUID 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 UUID principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The principal ID of the assigned identity. + * + * @param principalId the principalId value to set. + * @return the UserAssignedIdentity object itself. + */ + UserAssignedIdentity withPrincipalId(UUID principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Set the clientId property: The client ID of the assigned identity. + * + * @param clientId the clientId value to set. + * @return the UserAssignedIdentity object itself. + */ + UserAssignedIdentity withClientId(UUID clientId) { + this.clientId = clientId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@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.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/VirtualEnclavePatchResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/VirtualEnclavePatchResource.java new file mode 100644 index 000000000000..b5441b307f3b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/VirtualEnclavePatchResource.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 Resource. + */ +@Fluent +public final class VirtualEnclavePatchResource implements JsonSerializable { + /* + * Virtual Enclave Patch properties + */ + private UpdateVirtualEnclavePatchProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + private AzureResourceManagerCommonTypesManagedServiceIdentityUpdate identity; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of VirtualEnclavePatchResource class. + */ + public VirtualEnclavePatchResource() { + } + + /** + * Get the properties property: Virtual Enclave Patch properties. + * + * @return the properties value. + */ + public UpdateVirtualEnclavePatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Virtual Enclave Patch properties. + * + * @param properties the properties value to set. + * @return the VirtualEnclavePatchResource object itself. + */ + public VirtualEnclavePatchResource withProperties(UpdateVirtualEnclavePatchProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public AzureResourceManagerCommonTypesManagedServiceIdentityUpdate 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 VirtualEnclavePatchResource object itself. + */ + public VirtualEnclavePatchResource + withIdentity(AzureResourceManagerCommonTypesManagedServiceIdentityUpdate 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 VirtualEnclavePatchResource object itself. + */ + public VirtualEnclavePatchResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@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 VirtualEnclavePatchResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualEnclavePatchResource 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 VirtualEnclavePatchResource. + */ + public static VirtualEnclavePatchResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualEnclavePatchResource deserializedVirtualEnclavePatchResource = new VirtualEnclavePatchResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedVirtualEnclavePatchResource.properties + = UpdateVirtualEnclavePatchProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedVirtualEnclavePatchResource.identity + = AzureResourceManagerCommonTypesManagedServiceIdentityUpdate.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedVirtualEnclavePatchResource.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualEnclavePatchResource; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/VirtualEnclaves.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/VirtualEnclaves.java new file mode 100644 index 000000000000..e5fb0caeb6b1 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/VirtualEnclaves.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalCallbackRequest. + */ + ApprovalCallbackResponse approvalCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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 response body after handling of approvalDeletionCallbackRequest. + */ + ApprovalDeletionCallbackResponse approvalDeletionCallback(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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/WorkloadPatchResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/WorkloadPatchResource.java new file mode 100644 index 000000000000..a1974f0f5a68 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/WorkloadPatchResource.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 WorkloadPatchResource implements JsonSerializable { + /* + * Workload Patch properties + */ + private UpdateWorkloadPatchProperties properties; + + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of WorkloadPatchResource class. + */ + public WorkloadPatchResource() { + } + + /** + * Get the properties property: Workload Patch properties. + * + * @return the properties value. + */ + public UpdateWorkloadPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Workload Patch properties. + * + * @param properties the properties value to set. + * @return the WorkloadPatchResource object itself. + */ + public WorkloadPatchResource withProperties(UpdateWorkloadPatchProperties 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 WorkloadPatchResource object itself. + */ + public WorkloadPatchResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@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 WorkloadPatchResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkloadPatchResource 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 WorkloadPatchResource. + */ + public static WorkloadPatchResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkloadPatchResource deserializedWorkloadPatchResource = new WorkloadPatchResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedWorkloadPatchResource.properties = UpdateWorkloadPatchProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedWorkloadPatchResource.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedWorkloadPatchResource; + }); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/WorkloadResource.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/WorkloadResource.java new file mode 100644 index 000000000000..98f4b0042de8 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/WorkloadResource.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mission.fluent.models.WorkloadResourceInner; +import java.util.List; +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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Provisioning State. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the resourceGroupCollection property: List of resource group ids. + * + * @return the resourceGroupCollection value. + */ + List resourceGroupCollection(); + + /** + * 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.mission.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.WithResourceGroupCollection { + /** + * 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 resourceGroupCollection. + */ + interface WithResourceGroupCollection { + /** + * Specifies the resourceGroupCollection property: List of resource group ids.. + * + * @param resourceGroupCollection List of resource group ids. + * @return the next definition stage. + */ + WithCreate withResourceGroupCollection(List resourceGroupCollection); + } + } + + /** + * 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(UpdateWorkloadPatchProperties 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/WorkloadResourceListResult.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/WorkloadResourceListResult.java new file mode 100644 index 000000000000..f19cc34cfa37 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/WorkloadResourceListResult.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.mission.fluent.models.WorkloadResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a WorkloadResource list operation. + */ +@Fluent +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. + */ + public WorkloadResourceListResult() { + } + + /** + * Get the value property: The WorkloadResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The WorkloadResource items on this page. + * + * @param value the value value to set. + * @return the WorkloadResourceListResult object itself. + */ + public WorkloadResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the WorkloadResourceListResult object itself. + */ + public WorkloadResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model WorkloadResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkloadResourceListResult.class); + + /** + * {@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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Workloads.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Workloads.java new file mode 100644 index 000000000000..f55428bd53de --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/Workloads.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.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 { + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/package-info.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/models/package-info.java new file mode 100644 index 000000000000..d73a9ad7fde5 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/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) AutoRest Code Generator. + +/** + * Package containing the data models for MissionClient. + * Microsoft Mission Resource Provider management API. + */ +package com.azure.resourcemanager.mission.models; diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/package-info.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/package-info.java new file mode 100644 index 000000000000..98ac42ce8819 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/com/azure/resourcemanager/mission/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for MissionClient. + * Microsoft Mission Resource Provider management API. + */ +package com.azure.resourcemanager.mission; diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/java/module-info.java b/sdk/mission/azure-resourcemanager-mission/src/main/java/module-info.java new file mode 100644 index 000000000000..968626d45043 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.mission { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.mission; + exports com.azure.resourcemanager.mission.fluent; + exports com.azure.resourcemanager.mission.fluent.models; + exports com.azure.resourcemanager.mission.models; + + opens com.azure.resourcemanager.mission.fluent.models to com.azure.core; + opens com.azure.resourcemanager.mission.models to com.azure.core; +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mission/proxy-config.json b/sdk/mission/azure-resourcemanager-mission/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mission/proxy-config.json new file mode 100644 index 000000000000..334fefb1266b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mission/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.mission.implementation.ApprovalsClientImpl$ApprovalsService"],["com.azure.resourcemanager.mission.implementation.CommunitiesClientImpl$CommunitiesService"],["com.azure.resourcemanager.mission.implementation.CommunityEndpointsClientImpl$CommunityEndpointsService"],["com.azure.resourcemanager.mission.implementation.EnclaveConnectionsClientImpl$EnclaveConnectionsService"],["com.azure.resourcemanager.mission.implementation.EnclaveEndpointsClientImpl$EnclaveEndpointsService"],["com.azure.resourcemanager.mission.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.mission.implementation.TransitHubsClientImpl$TransitHubsService"],["com.azure.resourcemanager.mission.implementation.VirtualEnclavesClientImpl$VirtualEnclavesService"],["com.azure.resourcemanager.mission.implementation.WorkloadsClientImpl$WorkloadsService"]] \ No newline at end of file diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mission/reflect-config.json b/sdk/mission/azure-resourcemanager-mission/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mission/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-mission/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/mission/azure-resourcemanager-mission/src/main/resources/azure-resourcemanager-mission.properties b/sdk/mission/azure-resourcemanager-mission/src/main/resources/azure-resourcemanager-mission.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/main/resources/azure-resourcemanager-mission.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalCreateOrUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalCreateOrUpdateSamples.java new file mode 100644 index 000000000000..f2b94e186c07 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalCreateOrUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.ActionPerformed; +import com.azure.resourcemanager.mission.models.ApprovalStatus; +import com.azure.resourcemanager.mission.models.Approver; +import com.azure.resourcemanager.mission.models.RequestMetadata; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Approval CreateOrUpdate. + */ +public final class ApprovalCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Approvals_CreateOrUpdate.json + */ + /** + * Sample code: Approval_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.approvals() + .define("TestApprovals") + .withExistingResourceUri( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection") + .withParent1("string") + .withParent2("string") + .withRequestMetadata(new RequestMetadata().withResourceAction("string") + .withApprovalStatus(ApprovalStatus.APPROVED) + .withApprovalCallbackRoute("approvalCallback") + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}")) + .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")) + .create(); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalDeleteSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalDeleteSamples.java new file mode 100644 index 000000000000..d39543093507 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Approval Delete. + */ +public final class ApprovalDeleteSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Approvals_Delete. + * json + */ + /** + * Sample code: Approval_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalDelete(com.azure.resourcemanager.mission.MissionManager 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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalGetSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalGetSamples.java new file mode 100644 index 000000000000..f454b7629a72 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Approval Get. + */ +public final class ApprovalGetSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Approvals_Get.json + */ + /** + * Sample code: Approval_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalGet(com.azure.resourcemanager.mission.MissionManager 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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalInitiatorCallbackSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalInitiatorCallbackSamples.java new file mode 100644 index 000000000000..d802859794b4 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalInitiatorCallbackSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.InitiatorCallbackRequest; +import com.azure.resourcemanager.mission.models.InitiatorCallbackRequestApprovalStatus; + +/** + * Samples for Approval InitiatorCallback. + */ +public final class ApprovalInitiatorCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Approvals_InitiatorCallback.json + */ + /** + * Sample code: Approval_InitiatorCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalInitiatorCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.approvals() + .initiatorCallback( + "subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/enclaveconnections/TestMyEnclaveConnection", + "TestApprovals", + new InitiatorCallbackRequest().withApprovalStatus(InitiatorCallbackRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalListByParentSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalListByParentSamples.java new file mode 100644 index 000000000000..32ef367f300a --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalListByParentSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Approval ListByParent. + */ +public final class ApprovalListByParentSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Approvals_ListByParent.json + */ + /** + * Sample code: Approval_ListByParent. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalListByParent(com.azure.resourcemanager.mission.MissionManager 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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalUpdateSamples.java new file mode 100644 index 000000000000..64c826548b05 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/ApprovalUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.ActionPerformed; +import com.azure.resourcemanager.mission.models.ApprovalResource; +import com.azure.resourcemanager.mission.models.ApprovalStatus; +import com.azure.resourcemanager.mission.models.Approver; +import com.azure.resourcemanager.mission.models.RequestMetadataUpdate; +import com.azure.resourcemanager.mission.models.UpdateApprovalProperties; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Approval Update. + */ +public final class ApprovalUpdateSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Approvals_Update. + * json + */ + /** + * Sample code: Approval_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void approvalUpdate(com.azure.resourcemanager.mission.MissionManager 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 UpdateApprovalProperties().withParent1("string") + .withParent2("string") + .withRequestMetadata(new RequestMetadataUpdate().withResourceAction("string") + .withApprovalStatus(ApprovalStatus.APPROVED) + .withApprovalCallbackRoute("approvalCallback") + .withApprovalCallbackPayload("{\n \"key1\": \"value1\",\n \"key2\": \"value2\"\n}")) + .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"))) + .apply(); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityCheckAddressSpaceAvailabilitySamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityCheckAddressSpaceAvailabilitySamples.java new file mode 100644 index 000000000000..880cacabb61f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityCheckAddressSpaceAvailabilitySamples.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.CheckAddressSpaceAvailabilityRequest; +import com.azure.resourcemanager.mission.models.EnclaveVirtualNetwork; +import com.azure.resourcemanager.mission.models.SubnetConfiguration; +import java.util.Arrays; + +/** + * Samples for Community CheckAddressSpaceAvailability. + */ +public final class CommunityCheckAddressSpaceAvailabilitySamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Community_PostCheckAddressSpaceAvailability.json + */ + /** + * Sample code: Community_CheckAddressSpaceAvailability. + * + * @param manager Entry point to MissionManager. + */ + public static void + communityCheckAddressSpaceAvailability(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communities() + .checkAddressSpaceAvailabilityWithResponse("rgopenapi", "TestMyCommunity", + new CheckAddressSpaceAvailabilityRequest().withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Mission/communities/TestMyCommunity") + .withEnclaveVirtualNetwork(new EnclaveVirtualNetwork().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true) + .withConnectToAzureServices(true)), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityCreateOrUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityCreateOrUpdateSamples.java new file mode 100644 index 000000000000..8f22ba5ec065 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityCreateOrUpdateSamples.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.ApprovalPolicy; +import com.azure.resourcemanager.mission.models.ApprovalSettings; +import com.azure.resourcemanager.mission.models.ApprovalSettingsConnectionUpdateMode; +import com.azure.resourcemanager.mission.models.GovernedServiceItem; +import com.azure.resourcemanager.mission.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.mission.models.GovernedServiceItemOption; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfiguration; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationJustification; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationMode; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentity; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.mission.models.MandatoryApprover; +import com.azure.resourcemanager.mission.models.Principal; +import com.azure.resourcemanager.mission.models.PrincipalType; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import com.azure.resourcemanager.mission.models.ServiceIdentifier; +import com.azure.resourcemanager.mission.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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Community_CreateOrUpdate.json + */ + /** + * Sample code: Community_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void communityCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communities() + .define("TestMyCommunity") + .withRegion("westcentralus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("sampletag", "samplevalue")) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) + .withAddressSpace("10.0.0.0/24") + .withDnsServers(Arrays.asList("azure.net")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withId(ServiceIdentifier.AKS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.APP_SERVICE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.CONTAINER_REGISTRY) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.KEY_VAULT) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.MICROSOFT_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.MONITORING) + .withOption(GovernedServiceItemOption.fromString("Not Applicable")) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.POSTGRE_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.SERVICE_BUS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.STORAGE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.AZURE_FIREWALLS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.INSIGHTS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.LOGIC) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.DATA_CONNECTORS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false))) + .withCommunityRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withId("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().withId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))))) + .withApprovalSettings(new ApprovalSettings().withEndpointCreation(ApprovalPolicy.NOT_REQUIRED) + .withEndpointUpdate(ApprovalPolicy.REQUIRED) + .withEndpointDeletion(ApprovalPolicy.NOT_REQUIRED) + .withConnectionCreation(ApprovalPolicy.REQUIRED) + .withConnectionUpdate(ApprovalPolicy.REQUIRED) + .withConnectionUpdateMode(ApprovalSettingsConnectionUpdateMode.MANUAL) + .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 MaintenanceModeConfiguration().withMode(MaintenanceModeConfigurationMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationJustification.OFF)) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityDeleteSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityDeleteSamples.java new file mode 100644 index 000000000000..8687a355b57f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Community Delete. + */ +public final class CommunityDeleteSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Community_Delete. + * json + */ + /** + * Sample code: Community_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void communityDelete(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communities().delete("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsApprovalCallbackSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsApprovalCallbackSamples.java new file mode 100644 index 000000000000..7168c473d6cc --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsApprovalCallbackSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for CommunityEndpoints ApprovalCallback. + */ +public final class CommunityEndpointsApprovalCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_PostApprovalCallback.json + */ + /** + * Sample code: CommunityEndpoints_ApprovalCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsApprovalCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints() + .approvalCallback("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsApprovalDeletionCallbackSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsApprovalDeletionCallbackSamples.java new file mode 100644 index 000000000000..d2948394a408 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsApprovalDeletionCallbackSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for CommunityEndpoints ApprovalDeletionCallback. + */ +public final class CommunityEndpointsApprovalDeletionCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_ApprovalDeletionCallback.json + */ + /** + * Sample code: CommunityEndpoints_ApprovalDeletionCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void + communityEndpointsApprovalDeletionCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints() + .approvalDeletionCallback( + "rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsCreateOrUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..b55bd53ccef6 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsCreateOrUpdateSamples.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.mission.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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_CreateOrUpdate.json + */ + /** + * Sample code: CommunityEndpoints_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints() + .define("TestMyCommunityEndpoint") + .withRegion("West US") + .withExistingCommunity("rgopenapi", "TestMyCommunity") + .withTags(mapOf("sampletag", "samplevalue")) + .withRuleCollection(Arrays.asList(new CommunityEndpointDestinationRule().withDestination("foo.example.com") + .withPort("443") + .withDestinationType(DestinationType.FQDNTAG) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.TCP)) + .withTransitHubResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity/transitHubs/TestThName"))) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsDeleteSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsDeleteSamples.java new file mode 100644 index 000000000000..701b77263e22 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for CommunityEndpoints Delete. + */ +public final class CommunityEndpointsDeleteSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_Delete.json + */ + /** + * Sample code: CommunityEndpoints_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsDelete(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints() + .delete("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsGetSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsGetSamples.java new file mode 100644 index 000000000000..37dc304dd011 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for CommunityEndpoints Get. + */ +public final class CommunityEndpointsGetSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_Get.json + */ + /** + * Sample code: CommunityEndpoints_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsGet(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsListByCommunityResourceSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsListByCommunityResourceSamples.java new file mode 100644 index 000000000000..d02d6d96ca02 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsListByCommunityResourceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for CommunityEndpoints ListByCommunityResource. + */ +public final class CommunityEndpointsListByCommunityResourceSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_ListByCommunityResource.json + */ + /** + * Sample code: CommunityEndpoints_ListByCommunityResource. + * + * @param manager Entry point to MissionManager. + */ + public static void + communityEndpointsListByCommunityResource(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints() + .listByCommunityResource("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsListBySubscriptionSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsListBySubscriptionSamples.java new file mode 100644 index 000000000000..1a2ae76896c3 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsListBySubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for CommunityEndpoints ListBySubscription. + */ +public final class CommunityEndpointsListBySubscriptionSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_ListBySubscription.json + */ + /** + * Sample code: CommunityEndpoints_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsListBySubscription(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communityEndpoints().listBySubscription("TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsUpdateSamples.java new file mode 100644 index 000000000000..a9db950e3513 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityEndpointsUpdateSamples.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.CommunityEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.CommunityEndpointProtocol; +import com.azure.resourcemanager.mission.models.CommunityEndpointResource; +import com.azure.resourcemanager.mission.models.DestinationType; +import com.azure.resourcemanager.mission.models.UpdateCommunityEndpointPatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CommunityEndpoints Update. + */ +public final class CommunityEndpointsUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * CommunityEndpoints_Update.json + */ + /** + * Sample code: CommunityEndpoints_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void communityEndpointsUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + CommunityEndpointResource resource = manager.communityEndpoints() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestMyCommunityEndpoint", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new UpdateCommunityEndpointPatchProperties().withRuleCollection( + Arrays.asList(new CommunityEndpointDestinationRule().withDestination("foo.example.com") + .withPort("443") + .withDestinationType(DestinationType.FQDN) + .withProtocols(Arrays.asList(CommunityEndpointProtocol.TCP)) + .withTransitHubResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/testrg/providers/Microsoft.Mission/communities/TestMyCommunity/transitHubs/TestThName")))) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityGetByResourceGroupSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityGetByResourceGroupSamples.java new file mode 100644 index 000000000000..be2a50f67d50 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Community GetByResourceGroup. + */ +public final class CommunityGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Community_Get.json + */ + /** + * Sample code: Community_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void communityGet(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communities() + .getByResourceGroupWithResponse("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityListByResourceGroupSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityListByResourceGroupSamples.java new file mode 100644 index 000000000000..904df170a4d9 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Community ListByResourceGroup. + */ +public final class CommunityListByResourceGroupSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Community_ListByResourceGroup.json + */ + /** + * Sample code: Community_ListByResourceGroup. + * + * @param manager Entry point to MissionManager. + */ + public static void communityListByResourceGroup(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communities().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityListSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityListSamples.java new file mode 100644 index 000000000000..94136c933bed --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Community List. + */ +public final class CommunityListSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Community_ListBySubscription.json + */ + /** + * Sample code: Community_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void communityListBySubscription(com.azure.resourcemanager.mission.MissionManager manager) { + manager.communities().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityUpdateSamples.java new file mode 100644 index 000000000000..3ad972bc73c7 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/CommunityUpdateSamples.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.CommunityResource; +import com.azure.resourcemanager.mission.models.GovernedServiceItem; +import com.azure.resourcemanager.mission.models.GovernedServiceItemEnforcement; +import com.azure.resourcemanager.mission.models.GovernedServiceItemOption; +import com.azure.resourcemanager.mission.models.Principal; +import com.azure.resourcemanager.mission.models.PrincipalType; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import com.azure.resourcemanager.mission.models.ServiceIdentifier; +import com.azure.resourcemanager.mission.models.UpdateCommunityPatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Community Update. + */ +public final class CommunityUpdateSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Community_Update. + * json + */ + /** + * Sample code: Community_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void communityUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + CommunityResource resource = manager.communities() + .getByResourceGroupWithResponse("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new UpdateCommunityPatchProperties().withAddressSpace("10.0.0.0/24") + .withDnsServers(Arrays.asList("azure.net")) + .withGovernedServiceList(Arrays.asList( + new GovernedServiceItem().withId(ServiceIdentifier.AKS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.APP_SERVICE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.CONTAINER_REGISTRY) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.COSMOS_DB) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.KEY_VAULT) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.MICROSOFT_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.MONITORING) + .withOption(GovernedServiceItemOption.fromString("Not Applicable")) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.POSTGRE_SQL) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.SERVICE_BUS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.STORAGE) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.AZURE_FIREWALLS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.INSIGHTS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.LOGIC) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.PRIVATE_DNSZONES) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false), + new GovernedServiceItem().withId(ServiceIdentifier.DATA_CONNECTORS) + .withOption(GovernedServiceItemOption.ALLOW) + .withEnforcement(GovernedServiceItemEnforcement.ENABLED) + .withAuditOnly(false))) + .withCommunityRoleAssignments(Arrays.asList(new RoleAssignmentItem() + .withId("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().withId("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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionApprovalCallbackSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionApprovalCallbackSamples.java new file mode 100644 index 000000000000..b275dd88222f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionApprovalCallbackSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveConnection ApprovalCallback. + */ +public final class EnclaveConnectionApprovalCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_PostApprovalCallback.json + */ + /** + * Sample code: EnclaveConnection_ApprovalCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionApprovalCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections() + .approvalCallback("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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionApprovalDeletionCallbackSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionApprovalDeletionCallbackSamples.java new file mode 100644 index 000000000000..e09a32548c68 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionApprovalDeletionCallbackSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveConnection ApprovalDeletionCallback. + */ +public final class EnclaveConnectionApprovalDeletionCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_ApprovalDeletionCallback.json + */ + /** + * Sample code: EnclaveConnection_ApprovalDeletionCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void + enclaveConnectionApprovalDeletionCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections() + .approvalDeletionCallback("rgopenapi", "TestMyEnclaveConnection", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionCreateOrUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionCreateOrUpdateSamples.java new file mode 100644 index 000000000000..b6b51a1c88e7 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionCreateOrUpdateSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveConnection CreateOrUpdate. + */ +public final class EnclaveConnectionCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_CreateOrUpdate.json + */ + /** + * Sample code: EnclaveConnection_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections() + .define("TestMyEnclaveConnection") + .withRegion("West US") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("sampletag", "samplevalue")) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionDeleteSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionDeleteSamples.java new file mode 100644 index 000000000000..d54682bee99c --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for EnclaveConnection Delete. + */ +public final class EnclaveConnectionDeleteSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_Delete.json + */ + /** + * Sample code: EnclaveConnection_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionDelete(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections().delete("rgopenapi", "TestMyEnclaveConnection", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionGetByResourceGroupSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionGetByResourceGroupSamples.java new file mode 100644 index 000000000000..0de5172d57de --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for EnclaveConnection GetByResourceGroup. + */ +public final class EnclaveConnectionGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_Get.json + */ + /** + * Sample code: EnclaveConnection_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionGet(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclaveConnection", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionListByResourceGroupSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionListByResourceGroupSamples.java new file mode 100644 index 000000000000..10f4b095ef9c --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for EnclaveConnection ListByResourceGroup. + */ +public final class EnclaveConnectionListByResourceGroupSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_ListByResourceGroup.json + */ + /** + * Sample code: EnclaveConnection_ListByResourceGroup. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionListByResourceGroup(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionListSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionListSamples.java new file mode 100644 index 000000000000..daecab193e0a --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for EnclaveConnection List. + */ +public final class EnclaveConnectionListSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_ListBySubscription.json + */ + /** + * Sample code: EnclaveConnection_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionListBySubscription(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveConnections().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionUpdateSamples.java new file mode 100644 index 000000000000..df708e70f719 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveConnectionUpdateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.EnclaveConnectionResource; +import com.azure.resourcemanager.mission.models.UpdateEnclaveConnectionPatchProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveConnection Update. + */ +public final class EnclaveConnectionUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveConnection_Update.json + */ + /** + * Sample code: EnclaveConnection_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveConnectionUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + EnclaveConnectionResource resource = manager.enclaveConnections() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclaveConnection", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new UpdateEnclaveConnectionPatchProperties().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")) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsApprovalCallbackSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsApprovalCallbackSamples.java new file mode 100644 index 000000000000..acfe5c1fba1b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsApprovalCallbackSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveEndpoints ApprovalCallback. + */ +public final class EnclaveEndpointsApprovalCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_PostApprovalCallback.json + */ + /** + * Sample code: EnclaveEndpoints_ApprovalCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsApprovalCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints() + .approvalCallback("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", + new ApprovalCallbackRequest() + .withResourceRequestAction(ApprovalCallbackRequestResourceRequestAction.CREATE) + .withApprovalStatus(ApprovalCallbackRequestApprovalStatus.APPROVED), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsApprovalDeletionCallbackSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsApprovalDeletionCallbackSamples.java new file mode 100644 index 000000000000..70d37389f947 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsApprovalDeletionCallbackSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for EnclaveEndpoints ApprovalDeletionCallback. + */ +public final class EnclaveEndpointsApprovalDeletionCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_ApprovalDeletionCallback.json + */ + /** + * Sample code: EnclaveEndpoints_ApprovalDeletionCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void + enclaveEndpointsApprovalDeletionCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints() + .approvalDeletionCallback( + "rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsCreateOrUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..7d0924d94976 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsCreateOrUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.mission.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: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_CreateOrUpdate.json + */ + /** + * Sample code: EnclaveEndpoints_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints() + .define("TestMyEnclaveEndpoint") + .withRegion("West US") + .withExistingVirtualEnclave("rgopenapi", "TestMyEnclave") + .withTags(mapOf("sampletag", "samplevalue")) + .withRuleCollection( + Arrays.asList(new EnclaveEndpointDestinationRule().withName("54CEECEF-2C30-488E-946F-D20F414D99BA") + .withDestination("10.0.0.0/24") + .withPort("443") + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP)))) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsDeleteSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsDeleteSamples.java new file mode 100644 index 000000000000..1e511e84c88b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for EnclaveEndpoints Delete. + */ +public final class EnclaveEndpointsDeleteSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_Delete.json + */ + /** + * Sample code: EnclaveEndpoints_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsDelete(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints() + .delete("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsGetSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsGetSamples.java new file mode 100644 index 000000000000..6060318a2b44 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for EnclaveEndpoints Get. + */ +public final class EnclaveEndpointsGetSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/EnclaveEndpoints_Get + * .json + */ + /** + * Sample code: EnclaveEndpoints_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsGet(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsListByEnclaveResourceSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsListByEnclaveResourceSamples.java new file mode 100644 index 000000000000..43dbd77d008e --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsListByEnclaveResourceSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for EnclaveEndpoints ListByEnclaveResource. + */ +public final class EnclaveEndpointsListByEnclaveResourceSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_ListByEnclaveResource.json + */ + /** + * Sample code: EnclaveEndpoints_ListByEnclaveResource. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsListByEnclaveResource(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints() + .listByEnclaveResource("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsListBySubscriptionSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsListBySubscriptionSamples.java new file mode 100644 index 000000000000..1e9f692930eb --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsListBySubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for EnclaveEndpoints ListBySubscription. + */ +public final class EnclaveEndpointsListBySubscriptionSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_ListBySubscription.json + */ + /** + * Sample code: EnclaveEndpoints_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsListBySubscription(com.azure.resourcemanager.mission.MissionManager manager) { + manager.enclaveEndpoints().listBySubscription("TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsUpdateSamples.java new file mode 100644 index 000000000000..9d73f9c1521d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/EnclaveEndpointsUpdateSamples.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.EnclaveEndpointDestinationRule; +import com.azure.resourcemanager.mission.models.EnclaveEndpointProtocol; +import com.azure.resourcemanager.mission.models.EnclaveEndpointResource; +import com.azure.resourcemanager.mission.models.UpdateEnclaveEndpointPatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for EnclaveEndpoints Update. + */ +public final class EnclaveEndpointsUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * EnclaveEndpoints_Update.json + */ + /** + * Sample code: EnclaveEndpoints_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void enclaveEndpointsUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + EnclaveEndpointResource resource = manager.enclaveEndpoints() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyEnclaveEndpoint", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("sampletag", "samplevalue")) + .withProperties(new UpdateEnclaveEndpointPatchProperties().withRuleCollection( + Arrays.asList(new EnclaveEndpointDestinationRule().withName("54CEECEF-2C30-488E-946F-D20F414D99BA") + .withDestination("10.0.0.0/24") + .withPort("443") + .withProtocols(Arrays.asList(EnclaveEndpointProtocol.TCP))))) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/OperationsListSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/OperationsListSamples.java new file mode 100644 index 000000000000..7474cedef411 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Operations_List.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to MissionManager. + */ + public static void operationsList(com.azure.resourcemanager.mission.MissionManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubCreateOrUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubCreateOrUpdateSamples.java new file mode 100644 index 000000000000..ccaabb8af12d --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubCreateOrUpdateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.TransitHubState; +import com.azure.resourcemanager.mission.models.TransitOption; +import com.azure.resourcemanager.mission.models.TransitOptionParams; +import com.azure.resourcemanager.mission.models.TransitOptionType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for TransitHub CreateOrUpdate. + */ +public final class TransitHubCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * TransitHub_CreateOrUpdate.json + */ + /** + * Sample code: TransitHub_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.transitHubs() + .define("TestThName") + .withRegion("westcentralus") + .withExistingCommunity("rgopenapi", "TestMyCommunity") + .withTags(mapOf("Tag1", "Value1")) + .withState(TransitHubState.PENDING_APPROVAL) + .withTransitOption(new TransitOption().withType(TransitOptionType.EXPRESS_ROUTE) + .withParams(new TransitOptionParams().withScaleUnits(1L))) + .withResourceCollection(Arrays.asList("resCollection")) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubDeleteSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubDeleteSamples.java new file mode 100644 index 000000000000..add53eabeb49 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for TransitHub Delete. + */ +public final class TransitHubDeleteSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/TransitHub_Delete. + * json + */ + /** + * Sample code: TransitHub_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubDelete(com.azure.resourcemanager.mission.MissionManager manager) { + manager.transitHubs().delete("rgopenapi", "TestMyCommunity", "TestThName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubGetSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubGetSamples.java new file mode 100644 index 000000000000..95aee6840b29 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for TransitHub Get. + */ +public final class TransitHubGetSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/TransitHub_Get.json + */ + /** + * Sample code: TransitHub_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubGet(com.azure.resourcemanager.mission.MissionManager manager) { + manager.transitHubs() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestThName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubListByCommunityResourceSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubListByCommunityResourceSamples.java new file mode 100644 index 000000000000..bcd97dc3e070 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubListByCommunityResourceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for TransitHub ListByCommunityResource. + */ +public final class TransitHubListByCommunityResourceSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * TransitHub_ListByCommunityResource.json + */ + /** + * Sample code: TransitHub_ListByCommunityResource. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubListByCommunityResource(com.azure.resourcemanager.mission.MissionManager manager) { + manager.transitHubs().listByCommunityResource("rgopenapi", "TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubListBySubscriptionSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubListBySubscriptionSamples.java new file mode 100644 index 000000000000..f67a1cb9a613 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubListBySubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for TransitHub ListBySubscription. + */ +public final class TransitHubListBySubscriptionSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * TransitHub_ListBySubscription.json + */ + /** + * Sample code: TransitHub_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubListBySubscription(com.azure.resourcemanager.mission.MissionManager manager) { + manager.transitHubs().listBySubscription("TestMyCommunity", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubUpdateSamples.java new file mode 100644 index 000000000000..8cc67e2fbecc --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/TransitHubUpdateSamples.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.TransitHubResource; +import com.azure.resourcemanager.mission.models.TransitHubState; +import com.azure.resourcemanager.mission.models.TransitOption; +import com.azure.resourcemanager.mission.models.TransitOptionParams; +import com.azure.resourcemanager.mission.models.TransitOptionType; +import com.azure.resourcemanager.mission.models.UpdateTransitHubPatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for TransitHub Update. + */ +public final class TransitHubUpdateSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/TransitHub_Update. + * json + */ + /** + * Sample code: TransitHub_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void transitHubUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + TransitHubResource resource = manager.transitHubs() + .getWithResponse("rgopenapi", "TestMyCommunity", "TestThName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key4278", "fakeTokenPlaceholder")) + .withProperties(new UpdateTransitHubPatchProperties().withState(TransitHubState.PENDING_APPROVAL) + .withTransitOption(new TransitOption().withType(TransitOptionType.EXPRESS_ROUTE) + .withParams(new TransitOptionParams().withScaleUnits(1L))) + .withResourceCollection(Arrays.asList("resCollection"))) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveApprovalCallbackSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveApprovalCallbackSamples.java new file mode 100644 index 000000000000..108526307d0f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveApprovalCallbackSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestApprovalStatus; +import com.azure.resourcemanager.mission.models.ApprovalCallbackRequestResourceRequestAction; + +/** + * Samples for VirtualEnclave ApprovalCallback. + */ +public final class VirtualEnclaveApprovalCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_PostApprovalCallback.json + */ + /** + * Sample code: VirtualEnclave_ApprovalCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveApprovalCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves() + .approvalCallback("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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveApprovalDeletionCallbackSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveApprovalDeletionCallbackSamples.java new file mode 100644 index 000000000000..60f193759c36 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveApprovalDeletionCallbackSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequest; +import com.azure.resourcemanager.mission.models.ApprovalDeletionCallbackRequestResourceRequestAction; + +/** + * Samples for VirtualEnclave ApprovalDeletionCallback. + */ +public final class VirtualEnclaveApprovalDeletionCallbackSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_PostApprovalDeletionCallback.json + */ + /** + * Sample code: VirtualEnclave_ApprovalDeletionCallback. + * + * @param manager Entry point to MissionManager. + */ + public static void + virtualEnclaveApprovalDeletionCallback(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves() + .approvalDeletionCallback("rgopenapi", "TestMyEnclave", new ApprovalDeletionCallbackRequest() + .withResourceRequestAction(ApprovalDeletionCallbackRequestResourceRequestAction.CREATE), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveCreateOrUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveCreateOrUpdateSamples.java new file mode 100644 index 000000000000..c435548cc715 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveCreateOrUpdateSamples.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.DiagnosticDestination; +import com.azure.resourcemanager.mission.models.EnclaveDefaultSettings; +import com.azure.resourcemanager.mission.models.EnclaveVirtualNetwork; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfiguration; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationJustification; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationMode; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentity; +import com.azure.resourcemanager.mission.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.mission.models.Principal; +import com.azure.resourcemanager.mission.models.PrincipalType; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import com.azure.resourcemanager.mission.models.SubnetConfiguration; +import com.azure.resourcemanager.mission.models.UserAssignedIdentity; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for VirtualEnclave CreateOrUpdate. + */ +public final class VirtualEnclaveCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_CreateOrUpdate.json + */ + /** + * Sample code: VirtualEnclave_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves() + .define("TestMyEnclave") + .withRegion("westcentralus") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("Tag1", "Value1")) + .withIdentity(new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/subid/resourceGroups/default-azurebatch-japaneast/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) + .withEnclaveVirtualNetwork(new EnclaveVirtualNetwork().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true) + .withConnectToAzureServices(true)) + .withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/communities/TestMyCommunity") + .withEnclaveDefaultSettings(new EnclaveDefaultSettings().withKeyVaultResourceId("fakeTokenPlaceholder") + .withStorageAccountResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Storage/storageAccounts/TestMyStorageAccount") + .withLogAnalyticsResourceIdCollection(Arrays.asList( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.OperationalInsights/workspaces/TestMyLogA1", + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.OperationalInsights/workspaces/TestMyLogA2")) + .withDiagnosticDestination(DiagnosticDestination.BOTH)) + .withResourceCollection(Arrays.asList()) + .withMaintenanceModeConfiguration( + new MaintenanceModeConfiguration().withMode(MaintenanceModeConfigurationMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationJustification.OFF)) + .withBastionEnabled(true) + .withEnclaveRoleAssignments( + Arrays.asList( + new RoleAssignmentItem().withId("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().withId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER))))) + .withWorkloadRoleAssignments( + Arrays.asList( + new RoleAssignmentItem().withId("d73bb868-a0df-4d4d-bd69-98a00b01fccb") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))), + new RoleAssignmentItem().withId("fb879df8-f326-4884-b1cf-06f3ad86be52") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))))) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveDeleteSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveDeleteSamples.java new file mode 100644 index 000000000000..bf3873d5665f --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for VirtualEnclave Delete. + */ +public final class VirtualEnclaveDeleteSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_Delete.json + */ + /** + * Sample code: VirtualEnclave_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveDelete(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves().delete("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveGetByResourceGroupSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveGetByResourceGroupSamples.java new file mode 100644 index 000000000000..e7fd541a079e --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveGetByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for VirtualEnclave GetByResourceGroup. + */ +public final class VirtualEnclaveGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/VirtualEnclave_Get. + * json + */ + /** + * Sample code: VirtualEnclave_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveGet(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveListByResourceGroupSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveListByResourceGroupSamples.java new file mode 100644 index 000000000000..e89808b72d27 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for VirtualEnclave ListByResourceGroup. + */ +public final class VirtualEnclaveListByResourceGroupSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_ListByResourceGroup.json + */ + /** + * Sample code: VirtualEnclave_ListByResourceGroup. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveListByResourceGroup(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveListSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveListSamples.java new file mode 100644 index 000000000000..c32babf53b9b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for VirtualEnclave List. + */ +public final class VirtualEnclaveListSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_ListBySubscription.json + */ + /** + * Sample code: VirtualEnclave_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveListBySubscription(com.azure.resourcemanager.mission.MissionManager manager) { + manager.virtualEnclaves().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveUpdateSamples.java new file mode 100644 index 000000000000..b30266e6320e --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/VirtualEnclaveUpdateSamples.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.DiagnosticDestination; +import com.azure.resourcemanager.mission.models.EnclaveDefaultSettings; +import com.azure.resourcemanager.mission.models.EnclaveResource; +import com.azure.resourcemanager.mission.models.EnclaveVirtualNetwork; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationUpdate; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationUpdateJustification; +import com.azure.resourcemanager.mission.models.MaintenanceModeConfigurationUpdateMode; +import com.azure.resourcemanager.mission.models.Principal; +import com.azure.resourcemanager.mission.models.PrincipalType; +import com.azure.resourcemanager.mission.models.RoleAssignmentItem; +import com.azure.resourcemanager.mission.models.SubnetConfiguration; +import com.azure.resourcemanager.mission.models.UpdateVirtualEnclavePatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for VirtualEnclave Update. + */ +public final class VirtualEnclaveUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * VirtualEnclave_Update.json + */ + /** + * Sample code: VirtualEnclave_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void virtualEnclaveUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + EnclaveResource resource = manager.virtualEnclaves() + .getByResourceGroupWithResponse("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("Tag1", "Value1")) + .withProperties(new UpdateVirtualEnclavePatchProperties() + .withEnclaveVirtualNetwork(new EnclaveVirtualNetwork().withNetworkSize("small") + .withCustomCidrRange("10.0.0.0/24") + .withSubnetConfigurations( + Arrays.asList(new SubnetConfiguration().withName("test").withNetworkPrefixSize(26))) + .withAllowSubnetCommunication(true) + .withConnectToAzureServices(true)) + .withCommunityResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/microsoft.mission/communities/TestMyCommunity") + .withEnclaveDefaultSettings(new EnclaveDefaultSettings().withKeyVaultResourceId("fakeTokenPlaceholder") + .withStorageAccountResourceId( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.Storage/storageAccounts/TestMyStorageAccount") + .withLogAnalyticsResourceIdCollection(Arrays.asList( + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.OperationalInsights/workspaces/TestMyLogA1", + "/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg/providers/Microsoft.OperationalInsights/workspaces/TestMyLogA2")) + .withDiagnosticDestination(DiagnosticDestination.BOTH)) + .withResourceCollection( + Arrays.asList("/subscriptions/c64f6eca-bdc5-4bc2-88d6-f8f1dc23f86c/resourceGroups/TestMyRg")) + .withMaintenanceModeConfiguration(new MaintenanceModeConfigurationUpdate() + .withMode(MaintenanceModeConfigurationUpdateMode.OFF) + .withPrincipals(Arrays.asList( + new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9").withType(PrincipalType.USER))) + .withJustification(MaintenanceModeConfigurationUpdateJustification.OFF)) + .withBastionEnabled(true) + .withEnclaveRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withId("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().withId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withPrincipals(Arrays.asList(new Principal().withId("355a6bb0-abc0-4cba-000d-12a345b678c9") + .withType(PrincipalType.USER))))) + .withWorkloadRoleAssignments(Arrays.asList( + new RoleAssignmentItem().withId("d73bb868-a0df-4d4d-bd69-98a00b01fccb") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP))), + new RoleAssignmentItem().withId("fb879df8-f326-4884-b1cf-06f3ad86be52") + .withPrincipals(Arrays.asList(new Principal().withId("01234567-89ab-ef01-2345-0123456789ab") + .withType(PrincipalType.GROUP)))))) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadCreateOrUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadCreateOrUpdateSamples.java new file mode 100644 index 000000000000..4b9954b56e39 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadCreateOrUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Workload CreateOrUpdate. + */ +public final class WorkloadCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Workload_CreateOrUpdate.json + */ + /** + * Sample code: Workload_CreateOrUpdate. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadCreateOrUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + manager.workloads() + .define("TestMyWorkload") + .withRegion("westcentralus") + .withExistingVirtualEnclave("rgopenapi", "TestMyEnclave") + .withTags(mapOf("TestKey", "fakeTokenPlaceholder")) + .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/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadDeleteSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadDeleteSamples.java new file mode 100644 index 000000000000..2ad8809bff68 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Workload Delete. + */ +public final class WorkloadDeleteSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Workload_Delete.json + */ + /** + * Sample code: Workload_Delete. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadDelete(com.azure.resourcemanager.mission.MissionManager manager) { + manager.workloads().delete("rgopenapi", "TestMyEnclave", "TestMyWorkload", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadGetSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadGetSamples.java new file mode 100644 index 000000000000..8e71e337e112 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Workload Get. + */ +public final class WorkloadGetSamples { + /* + * x-ms-original-file: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Workload_Get.json + */ + /** + * Sample code: Workload_Get. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadGet(com.azure.resourcemanager.mission.MissionManager manager) { + manager.workloads() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyWorkload", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadListByEnclaveResourceSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadListByEnclaveResourceSamples.java new file mode 100644 index 000000000000..4922cc4d6c70 --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadListByEnclaveResourceSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Workload ListByEnclaveResource. + */ +public final class WorkloadListByEnclaveResourceSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Workload_ListByEnclaveResource.json + */ + /** + * Sample code: Workload_ListByEnclaveResource. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadListByEnclaveResource(com.azure.resourcemanager.mission.MissionManager manager) { + manager.workloads().listByEnclaveResource("rgopenapi", "TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadListBySubscriptionSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadListBySubscriptionSamples.java new file mode 100644 index 000000000000..0fe42569810b --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadListBySubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +/** + * Samples for Workload ListBySubscription. + */ +public final class WorkloadListBySubscriptionSamples { + /* + * x-ms-original-file: specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/ + * Workload_ListBySubscription.json + */ + /** + * Sample code: Workload_ListBySubscription. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadListBySubscription(com.azure.resourcemanager.mission.MissionManager manager) { + manager.workloads().listBySubscription("TestMyEnclave", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadUpdateSamples.java b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadUpdateSamples.java new file mode 100644 index 000000000000..daf9f7e7dcbb --- /dev/null +++ b/sdk/mission/azure-resourcemanager-mission/src/samples/java/com/azure/resourcemanager/mission/generated/WorkloadUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mission.generated; + +import com.azure.resourcemanager.mission.models.UpdateWorkloadPatchProperties; +import com.azure.resourcemanager.mission.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: + * specification/mission/resource-manager/Microsoft.Mission/preview/2024-12-01-preview/examples/Workload_Update.json + */ + /** + * Sample code: Workload_Update. + * + * @param manager Entry point to MissionManager. + */ + public static void workloadUpdate(com.azure.resourcemanager.mission.MissionManager manager) { + WorkloadResource resource = manager.workloads() + .getWithResponse("rgopenapi", "TestMyEnclave", "TestMyWorkload", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key9465", "fakeTokenPlaceholder")) + .withProperties(new UpdateWorkloadPatchProperties().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/mission/ci.yml b/sdk/mission/ci.yml new file mode 100644 index 000000000000..e5537aa217bf --- /dev/null +++ b/sdk/mission/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/mission/ci.yml + - sdk/mission/azure-resourcemanager-mission/ + exclude: + - sdk/mission/pom.xml + - sdk/mission/azure-resourcemanager-mission/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mission/ci.yml + - sdk/mission/azure-resourcemanager-mission/ + exclude: + - sdk/mission/pom.xml + - sdk/mission/azure-resourcemanager-mission/pom.xml + +parameters: + - name: release_azureresourcemanagermission + displayName: azure-resourcemanager-mission + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: mission + Artifacts: + - name: azure-resourcemanager-mission + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermission + releaseInBatch: ${{ parameters.release_azureresourcemanagermission }} diff --git a/sdk/mission/pom.xml b/sdk/mission/pom.xml new file mode 100644 index 000000000000..a1115f7c57fa --- /dev/null +++ b/sdk/mission/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-mission-service + pom + 1.0.0 + + + azure-resourcemanager-mission + +