diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 8439012f1403..00940794e6e8 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -505,6 +505,7 @@ com.azure.resourcemanager:azure-resourcemanager-resources-bicep;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-playwright;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagediscovery;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-containerservicesafeguards;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-azurestackhci-vm;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/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/CHANGELOG.md b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/CHANGELOG.md new file mode 100644 index 000000000000..367d7da1e3b5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-08-11) + +- Azure Resource Manager Azure Stack Hci Vm client library for Java. This package contains Microsoft Azure SDK for Azure Stack Hci Vm Management SDK. Azure Stack HCI management service. Package api-version 2025-06-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-azurestackhci-vm Java SDK. diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/README.md b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/README.md new file mode 100644 index 000000000000..c6575f486088 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Azure Stack Hci Vm client library for Java + +Azure Resource Manager Azure Stack Hci Vm client library for Java. + +This package contains Microsoft Azure SDK for Azure Stack Hci Vm Management SDK. Azure Stack HCI management service. Package api-version 2025-06-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-azurestackhci-vm;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-azurestackhci-vm + 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(); +AzureStackHciVmManager manager = AzureStackHciVmManager + .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/azurestackhci/azure-resourcemanager-azurestackhci-vm/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/azurestackhci/azure-resourcemanager-azurestackhci-vm/SAMPLE.md b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/SAMPLE.md new file mode 100644 index 000000000000..8d1d328812a3 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/SAMPLE.md @@ -0,0 +1,2096 @@ +# Code snippets and samples + + +## AttestationStatuses + +- [Get](#attestationstatuses_get) + +## GalleryImages + +- [CreateOrUpdate](#galleryimages_createorupdate) +- [Delete](#galleryimages_delete) +- [GetByResourceGroup](#galleryimages_getbyresourcegroup) +- [List](#galleryimages_list) +- [ListByResourceGroup](#galleryimages_listbyresourcegroup) +- [Update](#galleryimages_update) + +## GuestAgents + +- [Create](#guestagents_create) +- [Delete](#guestagents_delete) +- [Get](#guestagents_get) +- [ListByVirtualMachineInstance](#guestagents_listbyvirtualmachineinstance) + +## HybridIdentityMetadata + +- [Get](#hybrididentitymetadata_get) +- [ListByVirtualMachineInstance](#hybrididentitymetadata_listbyvirtualmachineinstance) + +## LogicalNetworks + +- [CreateOrUpdate](#logicalnetworks_createorupdate) +- [Delete](#logicalnetworks_delete) +- [GetByResourceGroup](#logicalnetworks_getbyresourcegroup) +- [List](#logicalnetworks_list) +- [ListByResourceGroup](#logicalnetworks_listbyresourcegroup) +- [Update](#logicalnetworks_update) + +## MarketplaceGalleryImages + +- [CreateOrUpdate](#marketplacegalleryimages_createorupdate) +- [Delete](#marketplacegalleryimages_delete) +- [GetByResourceGroup](#marketplacegalleryimages_getbyresourcegroup) +- [List](#marketplacegalleryimages_list) +- [ListByResourceGroup](#marketplacegalleryimages_listbyresourcegroup) +- [Update](#marketplacegalleryimages_update) + +## NetworkInterfaces + +- [CreateOrUpdate](#networkinterfaces_createorupdate) +- [Delete](#networkinterfaces_delete) +- [GetByResourceGroup](#networkinterfaces_getbyresourcegroup) +- [List](#networkinterfaces_list) +- [ListByResourceGroup](#networkinterfaces_listbyresourcegroup) +- [Update](#networkinterfaces_update) + +## NetworkSecurityGroups + +- [CreateOrUpdate](#networksecuritygroups_createorupdate) +- [Delete](#networksecuritygroups_delete) +- [GetByResourceGroup](#networksecuritygroups_getbyresourcegroup) +- [List](#networksecuritygroups_list) +- [ListByResourceGroup](#networksecuritygroups_listbyresourcegroup) +- [UpdateTags](#networksecuritygroups_updatetags) + +## SecurityRules + +- [CreateOrUpdate](#securityrules_createorupdate) +- [Delete](#securityrules_delete) +- [Get](#securityrules_get) +- [ListByNetworkSecurityGroup](#securityrules_listbynetworksecuritygroup) + +## StorageContainers + +- [CreateOrUpdate](#storagecontainers_createorupdate) +- [Delete](#storagecontainers_delete) +- [GetByResourceGroup](#storagecontainers_getbyresourcegroup) +- [List](#storagecontainers_list) +- [ListByResourceGroup](#storagecontainers_listbyresourcegroup) +- [Update](#storagecontainers_update) + +## VirtualHardDisks + +- [CreateOrUpdate](#virtualharddisks_createorupdate) +- [Delete](#virtualharddisks_delete) +- [GetByResourceGroup](#virtualharddisks_getbyresourcegroup) +- [List](#virtualharddisks_list) +- [ListByResourceGroup](#virtualharddisks_listbyresourcegroup) +- [Update](#virtualharddisks_update) +- [Upload](#virtualharddisks_upload) + +## VirtualMachineInstances + +- [CreateOrUpdate](#virtualmachineinstances_createorupdate) +- [Delete](#virtualmachineinstances_delete) +- [Get](#virtualmachineinstances_get) +- [List](#virtualmachineinstances_list) +- [Pause](#virtualmachineinstances_pause) +- [Restart](#virtualmachineinstances_restart) +- [Save](#virtualmachineinstances_save) +- [Start](#virtualmachineinstances_start) +- [Stop](#virtualmachineinstances_stop) +- [Update](#virtualmachineinstances_update) +### AttestationStatuses_Get + +```java +/** + * Samples for AttestationStatuses Get. + */ +public final class AttestationStatusesGetSamples { + /* + * x-ms-original-file: 2025-06-01-preview/AttestationStatuses_Get.json + */ + /** + * Sample code: GetAttestationStatus. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getAttestationStatus(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.attestationStatuses() + .getWithResponse( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} +``` + +### GalleryImages_CreateOrUpdate + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.OperatingSystemTypes; + +/** + * Samples for GalleryImages CreateOrUpdate. + */ +public final class GalleryImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_CreateOrUpdate.json + */ + /** + * Sample code: PutGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.galleryImages() + .define("test-gallery-image") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withProperties(new GalleryImageProperties().withContainerId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container") + .withImagePath("C:\\test.vhdx") + .withOsType(OperatingSystemTypes.LINUX)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} +``` + +### GalleryImages_Delete + +```java +/** + * Samples for GalleryImages Delete. + */ +public final class GalleryImagesDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_Delete.json + */ + /** + * Sample code: DeleteGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void deleteGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.galleryImages().delete("test-rg", "test-gallery-image", com.azure.core.util.Context.NONE); + } +} +``` + +### GalleryImages_GetByResourceGroup + +```java +/** + * Samples for GalleryImages GetByResourceGroup. + */ +public final class GalleryImagesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_Get.json + */ + /** + * Sample code: GetGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.galleryImages() + .getByResourceGroupWithResponse("test-rg", "test-gallery-image", com.azure.core.util.Context.NONE); + } +} +``` + +### GalleryImages_List + +```java +/** + * Samples for GalleryImages List. + */ +public final class GalleryImagesListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_ListAll.json + */ + /** + * Sample code: ListGalleryImageBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listGalleryImageBySubscription(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.galleryImages().list(com.azure.core.util.Context.NONE); + } +} +``` + +### GalleryImages_ListByResourceGroup + +```java +/** + * Samples for GalleryImages ListByResourceGroup. + */ +public final class GalleryImagesListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_ListByResourceGroup.json + */ + /** + * Sample code: ListGalleryImageByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listGalleryImageByResourceGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.galleryImages().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} +``` + +### GalleryImages_Update + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImage; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for GalleryImages Update. + */ +public final class GalleryImagesUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_Update.json + */ + /** + * Sample code: UpdateGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void updateGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + GalleryImage resource = manager.galleryImages() + .getByResourceGroupWithResponse("test-rg", "test-gallery-image", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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; + } +} +``` + +### GuestAgents_Create + +```java +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GuestAgentInner; +import com.azure.resourcemanager.azurestackhci.vm.models.GuestAgentProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.GuestCredential; +import com.azure.resourcemanager.azurestackhci.vm.models.ProvisioningAction; + +/** + * Samples for GuestAgents Create. + */ +public final class GuestAgentsCreateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GuestAgents_Create.json + */ + /** + * Sample code: CreateGuestAgent. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void createGuestAgent(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.guestAgents() + .create( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new GuestAgentInner().withProperties(new GuestAgentProperties() + .withCredentials( + new GuestCredential().withUsername("tempuser").withPassword("fakeTokenPlaceholder")) + .withProvisioningAction(ProvisioningAction.INSTALL)), + com.azure.core.util.Context.NONE); + } +} +``` + +### GuestAgents_Delete + +```java +/** + * Samples for GuestAgents Delete. + */ +public final class GuestAgentsDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GuestAgents_Delete.json + */ + /** + * Sample code: DeleteGuestAgent. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void deleteGuestAgent(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.guestAgents() + .delete( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} +``` + +### GuestAgents_Get + +```java +/** + * Samples for GuestAgents Get. + */ +public final class GuestAgentsGetSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GuestAgents_Get.json + */ + /** + * Sample code: GetGuestAgent. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getGuestAgent(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.guestAgents() + .getWithResponse( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} +``` + +### GuestAgents_ListByVirtualMachineInstance + +```java +/** + * Samples for GuestAgents ListByVirtualMachineInstance. + */ +public final class GuestAgentsListByVirtualMachineInstanceSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GuestAgents_ListByVirtualMachineInstance.json + */ + /** + * Sample code: GuestAgentListByVirtualMachineInstances. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void guestAgentListByVirtualMachineInstances( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.guestAgents() + .listByVirtualMachineInstance( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} +``` + +### HybridIdentityMetadata_Get + +```java +/** + * Samples for HybridIdentityMetadata Get. + */ +public final class HybridIdentityMetadataGetSamples { + /* + * x-ms-original-file: 2025-06-01-preview/HybridIdentityMetadataGroup_Get.json + */ + /** + * Sample code: GetHybridIdentityMetadata. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + getHybridIdentityMetadata(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.hybridIdentityMetadatas() + .getWithResponse( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} +``` + +### HybridIdentityMetadata_ListByVirtualMachineInstance + +```java +/** + * Samples for HybridIdentityMetadata ListByVirtualMachineInstance. + */ +public final class HybridIdentityMetadataListByVirtualMachineInstanceSamples { + /* + * x-ms-original-file: 2025-06-01-preview/HybridIdentityMetadata_ListByVirtualMachineInstance.json + */ + /** + * Sample code: HybridIdentityMetadataListByVirtualMachineInstances. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void hybridIdentityMetadataListByVirtualMachineInstances( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.hybridIdentityMetadatas() + .listByVirtualMachineInstance( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} +``` + +### LogicalNetworks_CreateOrUpdate + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; + +/** + * Samples for LogicalNetworks CreateOrUpdate. + */ +public final class LogicalNetworksCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_CreateOrUpdate.json + */ + /** + * Sample code: PutLogicalNetwork. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putLogicalNetwork(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.logicalNetworks() + .define("test-lnet") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} +``` + +### LogicalNetworks_Delete + +```java +/** + * Samples for LogicalNetworks Delete. + */ +public final class LogicalNetworksDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_Delete.json + */ + /** + * Sample code: DeleteLogicalNetwork. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void deleteLogicalNetwork(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.logicalNetworks().delete("test-rg", "test-lnet", com.azure.core.util.Context.NONE); + } +} +``` + +### LogicalNetworks_GetByResourceGroup + +```java +/** + * Samples for LogicalNetworks GetByResourceGroup. + */ +public final class LogicalNetworksGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_Get.json + */ + /** + * Sample code: GetLogicalNetwork. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getLogicalNetwork(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.logicalNetworks() + .getByResourceGroupWithResponse("test-rg", "test-lnet", com.azure.core.util.Context.NONE); + } +} +``` + +### LogicalNetworks_List + +```java +/** + * Samples for LogicalNetworks List. + */ +public final class LogicalNetworksListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_ListAll.json + */ + /** + * Sample code: ListLogicalNetworkBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listLogicalNetworkBySubscription(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.logicalNetworks().list(com.azure.core.util.Context.NONE); + } +} +``` + +### LogicalNetworks_ListByResourceGroup + +```java +/** + * Samples for LogicalNetworks ListByResourceGroup. + */ +public final class LogicalNetworksListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_ListByResourceGroup.json + */ + /** + * Sample code: ListLogicalNetworkByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listLogicalNetworkByResourceGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.logicalNetworks().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} +``` + +### LogicalNetworks_Update + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetwork; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for LogicalNetworks Update. + */ +public final class LogicalNetworksUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_Update.json + */ + /** + * Sample code: UpdateLogicalNetwork. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void updateLogicalNetwork(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + LogicalNetwork resource = manager.logicalNetworks() + .getByResourceGroupWithResponse("test-rg", "test-lnet", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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; + } +} +``` + +### MarketplaceGalleryImages_CreateOrUpdate + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.CloudInitDataSource; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageIdentifier; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageVersion; +import com.azure.resourcemanager.azurestackhci.vm.models.HyperVGeneration; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.OperatingSystemTypes; + +/** + * Samples for MarketplaceGalleryImages CreateOrUpdate. + */ +public final class MarketplaceGalleryImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_CreateOrUpdate.json + */ + /** + * Sample code: PutMarketplaceGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + putMarketplaceGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.marketplaceGalleryImages() + .define("test-marketplace-gallery-image") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withProperties(new MarketplaceGalleryImageProperties().withContainerId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCloudInitDataSource(CloudInitDataSource.AZURE) + .withHyperVGeneration(HyperVGeneration.V1) + .withIdentifier(new GalleryImageIdentifier().withPublisher("myPublisherName") + .withOffer("myOfferName") + .withSku("mySkuName")) + .withVersion(new GalleryImageVersion().withName("1.0.0"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} +``` + +### MarketplaceGalleryImages_Delete + +```java +/** + * Samples for MarketplaceGalleryImages Delete. + */ +public final class MarketplaceGalleryImagesDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_Delete.json + */ + /** + * Sample code: DeleteMarketplaceGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + deleteMarketplaceGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.marketplaceGalleryImages() + .delete("test-rg", "test-marketplace-gallery-image", com.azure.core.util.Context.NONE); + } +} +``` + +### MarketplaceGalleryImages_GetByResourceGroup + +```java +/** + * Samples for MarketplaceGalleryImages GetByResourceGroup. + */ +public final class MarketplaceGalleryImagesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_Get.json + */ + /** + * Sample code: GetMarketplaceGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + getMarketplaceGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.marketplaceGalleryImages() + .getByResourceGroupWithResponse("test-rg", "test-marketplace-gallery-image", + com.azure.core.util.Context.NONE); + } +} +``` + +### MarketplaceGalleryImages_List + +```java +/** + * Samples for MarketplaceGalleryImages List. + */ +public final class MarketplaceGalleryImagesListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_ListAll.json + */ + /** + * Sample code: ListMarketplaceGalleryImageBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void listMarketplaceGalleryImageBySubscription( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.marketplaceGalleryImages().list(com.azure.core.util.Context.NONE); + } +} +``` + +### MarketplaceGalleryImages_ListByResourceGroup + +```java +/** + * Samples for MarketplaceGalleryImages ListByResourceGroup. + */ +public final class MarketplaceGalleryImagesListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_ListByResourceGroup.json + */ + /** + * Sample code: ListMarketplaceGalleryImageByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void listMarketplaceGalleryImageByResourceGroup( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.marketplaceGalleryImages().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} +``` + +### MarketplaceGalleryImages_Update + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImage; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for MarketplaceGalleryImages Update. + */ +public final class MarketplaceGalleryImagesUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_Update.json + */ + /** + * Sample code: UpdateMarketplaceGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + updateMarketplaceGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + MarketplaceGalleryImage resource = manager.marketplaceGalleryImages() + .getByResourceGroupWithResponse("test-rg", "test-marketplce-gallery-image", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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; + } +} +``` + +### NetworkInterfaces_CreateOrUpdate + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.IPConfiguration; +import com.azure.resourcemanager.azurestackhci.vm.models.IPConfigurationProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceProperties; +import java.util.Arrays; + +/** + * Samples for NetworkInterfaces CreateOrUpdate. + */ +public final class NetworkInterfacesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces__CreateOrUpdate_CreateFromLocal.json + */ + /** + * Sample code: CreateNetworkInterfaceFromLocal. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + createNetworkInterfaceFromLocal(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces() + .define("test-nic") + .withRegion("eastus") + .withExistingResourceGroup("test-rg") + .withProperties(new NetworkInterfaceProperties().withIpConfigurations(Arrays.asList(new IPConfiguration() + .withName("ipconfig-sample") + .withProperties(new IPConfigurationProperties().withSubnet(new LogicalNetworkArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"))))) + .withCreateFromLocal(true)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } + + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_CreateOrUpdate.json + */ + /** + * Sample code: PutNetworkInterface. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putNetworkInterface(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces() + .define("test-nic") + .withRegion("eastus") + .withExistingResourceGroup("test-rg") + .withProperties(new NetworkInterfaceProperties().withIpConfigurations(Arrays.asList(new IPConfiguration() + .withName("ipconfig-sample") + .withProperties(new IPConfigurationProperties().withSubnet(new LogicalNetworkArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet")))))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} +``` + +### NetworkInterfaces_Delete + +```java +/** + * Samples for NetworkInterfaces Delete. + */ +public final class NetworkInterfacesDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_Delete.json + */ + /** + * Sample code: DeleteNetworkInterface. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + deleteNetworkInterface(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces().delete("test-rg", "test-nic", com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkInterfaces_GetByResourceGroup + +```java +/** + * Samples for NetworkInterfaces GetByResourceGroup. + */ +public final class NetworkInterfacesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_Get.json + */ + /** + * Sample code: GetNetworkInterface. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getNetworkInterface(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces() + .getByResourceGroupWithResponse("test-rg", "test-nic", com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkInterfaces_List + +```java +/** + * Samples for NetworkInterfaces List. + */ +public final class NetworkInterfacesListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_ListAll.json + */ + /** + * Sample code: ListNetworkInterfaceBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listNetworkInterfaceBySubscription(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces().list(com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkInterfaces_ListByResourceGroup + +```java +/** + * Samples for NetworkInterfaces ListByResourceGroup. + */ +public final class NetworkInterfacesListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_ListByResourceGroup.json + */ + /** + * Sample code: ListNetworkInterfaceByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listNetworkInterfaceByResourceGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkInterfaces_Update + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterface; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for NetworkInterfaces Update. + */ +public final class NetworkInterfacesUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_Update.json + */ + /** + * Sample code: UpdateNetworkInterface. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + updateNetworkInterface(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + NetworkInterface resource = manager.networkInterfaces() + .getByResourceGroupWithResponse("test-rg", "test-nic", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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; + } +} +``` + +### NetworkSecurityGroups_CreateOrUpdate + +```java +/** + * Samples for NetworkSecurityGroups CreateOrUpdate. + */ +public final class NetworkSecurityGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_CreateOrUpdate.json + */ + /** + * Sample code: CreateNetworkSecurityGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + createNetworkSecurityGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkSecurityGroups() + .define("testnsg") + .withRegion("eastus") + .withExistingResourceGroup("testrg") + .create(); + } +} +``` + +### NetworkSecurityGroups_Delete + +```java +/** + * Samples for NetworkSecurityGroups Delete. + */ +public final class NetworkSecurityGroupsDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_Delete.json + */ + /** + * Sample code: Delete network security group. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + deleteNetworkSecurityGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkSecurityGroups().delete("test-rg", "testnsg", com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkSecurityGroups_GetByResourceGroup + +```java +/** + * Samples for NetworkSecurityGroups GetByResourceGroup. + */ +public final class NetworkSecurityGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_Get.json + */ + /** + * Sample code: Get network security group. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + getNetworkSecurityGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkSecurityGroups() + .getByResourceGroupWithResponse("test-rg", "testnsg", com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkSecurityGroups_List + +```java +/** + * Samples for NetworkSecurityGroups List. + */ +public final class NetworkSecurityGroupsListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_ListAll.json + */ + /** + * Sample code: List all network security groups. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listAllNetworkSecurityGroups(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkSecurityGroups().list(com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkSecurityGroups_ListByResourceGroup + +```java +/** + * Samples for NetworkSecurityGroups ListByResourceGroup. + */ +public final class NetworkSecurityGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_ListByResourceGroup.json + */ + /** + * Sample code: List network security groups in resource group. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void listNetworkSecurityGroupsInResourceGroup( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkSecurityGroups().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### NetworkSecurityGroups_UpdateTags + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroup; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for NetworkSecurityGroups UpdateTags. + */ +public final class NetworkSecurityGroupsUpdateTagsSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_UpdateTags.json + */ + /** + * Sample code: Update network security group tags. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + updateNetworkSecurityGroupTags(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + NetworkSecurityGroup resource = manager.networkSecurityGroups() + .getByResourceGroupWithResponse("testrg", "testnsg", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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; + } +} +``` + +### SecurityRules_CreateOrUpdate + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleAccess; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleDirection; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProtocol; +import java.util.Arrays; + +/** + * Samples for SecurityRules CreateOrUpdate. + */ +public final class SecurityRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/SecurityRules_CreateOrUpdate.json + */ + /** + * Sample code: SecurityRulesCreateOrUpdate. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + securityRulesCreateOrUpdate(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.securityRules() + .define("rule1") + .withExistingNetworkSecurityGroup("testrg", "testnsg") + .withProperties(new SecurityRuleProperties().withProtocol(SecurityRuleProtocol.ASTERISK) + .withSourceAddressPrefixes(Arrays.asList("*")) + .withDestinationAddressPrefixes(Arrays.asList("*")) + .withSourcePortRanges(Arrays.asList("*")) + .withDestinationPortRanges(Arrays.asList("80")) + .withAccess(SecurityRuleAccess.ALLOW) + .withPriority(130) + .withDirection(SecurityRuleDirection.INBOUND)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} +``` + +### SecurityRules_Delete + +```java +/** + * Samples for SecurityRules Delete. + */ +public final class SecurityRulesDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/SecurityRules_Delete.json + */ + /** + * Sample code: SecurityRulesDelete. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void securityRulesDelete(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.securityRules().delete("testrg", "testnsg", "rule1", com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityRules_Get + +```java +/** + * Samples for SecurityRules Get. + */ +public final class SecurityRulesGetSamples { + /* + * x-ms-original-file: 2025-06-01-preview/SecurityRules_Get.json + */ + /** + * Sample code: Get network security rule in network security group. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getNetworkSecurityRuleInNetworkSecurityGroup( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.securityRules().getWithResponse("testrg", "testnsg", "rule1", com.azure.core.util.Context.NONE); + } +} +``` + +### SecurityRules_ListByNetworkSecurityGroup + +```java +/** + * Samples for SecurityRules ListByNetworkSecurityGroup. + */ +public final class SecurityRulesListByNetworkSecurityGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/SecurityRules_ListByNetworkSecurityGroup.json + */ + /** + * Sample code: List network security rules in network security group. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void listNetworkSecurityRulesInNetworkSecurityGroup( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.securityRules().listByNetworkSecurityGroup("testrg", "testnsg", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageContainers_CreateOrUpdate + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerProperties; + +/** + * Samples for StorageContainers CreateOrUpdate. + */ +public final class StorageContainersCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_CreateOrUpdate.json + */ + /** + * Sample code: PutStorageContainer. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putStorageContainer(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.storageContainers() + .define("Default_Container") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withProperties(new StorageContainerProperties().withPath("C:\\container_storage")) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} +``` + +### StorageContainers_Delete + +```java +/** + * Samples for StorageContainers Delete. + */ +public final class StorageContainersDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_Delete.json + */ + /** + * Sample code: DeleteStorageContainer. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + deleteStorageContainer(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.storageContainers().delete("test-rg", "Default_Container", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageContainers_GetByResourceGroup + +```java +/** + * Samples for StorageContainers GetByResourceGroup. + */ +public final class StorageContainersGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_Get.json + */ + /** + * Sample code: GetStorageContainer. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getStorageContainer(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.storageContainers() + .getByResourceGroupWithResponse("test-rg", "Default_Container", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageContainers_List + +```java +/** + * Samples for StorageContainers List. + */ +public final class StorageContainersListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_ListAll.json + */ + /** + * Sample code: ListStorageContainerBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listStorageContainerBySubscription(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.storageContainers().list(com.azure.core.util.Context.NONE); + } +} +``` + +### StorageContainers_ListByResourceGroup + +```java +/** + * Samples for StorageContainers ListByResourceGroup. + */ +public final class StorageContainersListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_ListByResourceGroup.json + */ + /** + * Sample code: ListStorageContainerByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listStorageContainerByResourceGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.storageContainers().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageContainers_Update + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainer; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageContainers Update. + */ +public final class StorageContainersUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_Update.json + */ + /** + * Sample code: UpdateStorageContainer. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + updateStorageContainer(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + StorageContainer resource = manager.storageContainers() + .getByResourceGroupWithResponse("test-rg", "Default_Container", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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; + } +} +``` + +### VirtualHardDisks_CreateOrUpdate + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskProperties; + +/** + * Samples for VirtualHardDisks CreateOrUpdate. + */ +public final class VirtualHardDisksCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks__CreateOrUpdate_CreateFromLocal.json + */ + /** + * Sample code: CreateVirtualHardDiskFromLocal. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + createVirtualHardDiskFromLocal(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks() + .define("test-vhd") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withProperties(new VirtualHardDiskProperties().withCreateFromLocal(true) + .withContainerId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container")) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } + + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_CreateOrUpdate.json + */ + /** + * Sample code: PutVirtualHardDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putVirtualHardDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks() + .define("test-vhd") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withProperties(new VirtualHardDiskProperties().withDiskSizeGB(32L)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} +``` + +### VirtualHardDisks_Delete + +```java +/** + * Samples for VirtualHardDisks Delete. + */ +public final class VirtualHardDisksDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_Delete.json + */ + /** + * Sample code: DeleteVirtualHardDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + deleteVirtualHardDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks().delete("test-rg", "test-vhd", com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualHardDisks_GetByResourceGroup + +```java +/** + * Samples for VirtualHardDisks GetByResourceGroup. + */ +public final class VirtualHardDisksGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_Get.json + */ + /** + * Sample code: GetVirtualHardDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getVirtualHardDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks() + .getByResourceGroupWithResponse("test-rg", "test-vhd", com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualHardDisks_List + +```java +/** + * Samples for VirtualHardDisks List. + */ +public final class VirtualHardDisksListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_ListAll.json + */ + /** + * Sample code: ListVirtualHardDiskBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listVirtualHardDiskBySubscription(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks().list(com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualHardDisks_ListByResourceGroup + +```java +/** + * Samples for VirtualHardDisks ListByResourceGroup. + */ +public final class VirtualHardDisksListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_ListByResourceGroup.json + */ + /** + * Sample code: ListVirtualHardDiskByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listVirtualHardDiskByResourceGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualHardDisks_Update + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisk; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for VirtualHardDisks Update. + */ +public final class VirtualHardDisksUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_Update.json + */ + /** + * Sample code: UpdateVirtualHardDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + updateVirtualHardDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + VirtualHardDisk resource = manager.virtualHardDisks() + .getByResourceGroupWithResponse("test-rg", "test-vhd", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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; + } +} +``` + +### VirtualHardDisks_Upload + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadRequest; + +/** + * Samples for VirtualHardDisks Upload. + */ +public final class VirtualHardDisksUploadSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_Upload.json + */ + /** + * Sample code: UploadVirtualHardDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + uploadVirtualHardDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks() + .upload("test-rg", "test-vhd", new VirtualHardDiskUploadRequest().withAzureManagedDiskUploadUrl( + "https://YourStorageAccountName.blob.core.windows.net/YourContainerName/YourVHDBlobName.vhd?"), + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualMachineInstances_CreateOrUpdate + +```java +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.GpuAssignmentTypeEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.ImageArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesNetworkProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesOsProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesSecurityProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesSecurityProfileUefiSettings; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesStorageProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesStorageProfileOsDisk; +import com.azure.resourcemanager.azurestackhci.vm.models.VmSizeEnum; +import java.util.Arrays; + +/** + * Samples for VirtualMachineInstances CreateOrUpdate. + */ +public final class VirtualMachineInstancesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * 2025-06-01-preview/VirtualMachineInstances_CreateOrUpdate_Put_Virtual_Machine_Instance_With_Gallery_Image.json + */ + /** + * Sample code: PutVirtualMachineInstanceWithGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putVirtualMachineInstanceWithGalleryImage( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner().withProperties(new VirtualMachineInstanceProperties() + .withHardwareProfile( + new VirtualMachineInstancePropertiesHardwareProfile().withVmSize(VmSizeEnum.DEFAULT)) + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withOsProfile( + new VirtualMachineInstancePropertiesOsProfile().withAdminPassword("fakeTokenPlaceholder") + .withAdminUsername("localadmin") + .withComputerName("luamaster")) + .withSecurityProfile(new VirtualMachineInstancePropertiesSecurityProfile().withEnableTPM(true) + .withUefiSettings(new VirtualMachineInstancePropertiesSecurityProfileUefiSettings() + .withSecureBootEnabled(true))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile() + .withImageReference(new ImageArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image")) + .withVmConfigStoragePathId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * 2025-06-01-preview/VirtualMachineInstances_CreateOrUpdate_Put_Virtual_Machine_Instance_With_Os_Disk.json + */ + /** + * Sample code: PutVirtualMachineInstanceWithOsDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + putVirtualMachineInstanceWithOsDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner().withProperties(new VirtualMachineInstanceProperties() + .withHardwareProfile( + new VirtualMachineInstancePropertiesHardwareProfile().withVmSize(VmSizeEnum.DEFAULT)) + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withSecurityProfile(new VirtualMachineInstancePropertiesSecurityProfile().withEnableTPM(true) + .withUefiSettings(new VirtualMachineInstancePropertiesSecurityProfileUefiSettings() + .withSecureBootEnabled(true))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile() + .withOsDisk(new VirtualMachineInstancePropertiesStorageProfileOsDisk().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd")) + .withVmConfigStoragePathId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-06-01-preview/ + * VirtualMachineInstances_CreateOrUpdate_Put_Virtual_Machine_Instance_With_Marketplace_Gallery_Image.json + */ + /** + * Sample code: PutVirtualMachineInstanceWithMarketplaceGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putVirtualMachineInstanceWithMarketplaceGalleryImage( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner().withProperties(new VirtualMachineInstanceProperties() + .withHardwareProfile( + new VirtualMachineInstancePropertiesHardwareProfile().withVmSize(VmSizeEnum.DEFAULT)) + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withOsProfile( + new VirtualMachineInstancePropertiesOsProfile().withAdminPassword("fakeTokenPlaceholder") + .withAdminUsername("localadmin") + .withComputerName("luamaster")) + .withSecurityProfile(new VirtualMachineInstancePropertiesSecurityProfile().withEnableTPM(true) + .withUefiSettings(new VirtualMachineInstancePropertiesSecurityProfileUefiSettings() + .withSecureBootEnabled(true))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile() + .withImageReference(new ImageArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image")) + .withVmConfigStoragePathId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * 2025-06-01-preview/VirtualMachineInstances_CreateOrUpdate_Put_Virtual_Machine_Instance_With_Vm_Config_Agent.json + */ + /** + * Sample code: PutVirtualMachineInstanceWithVMConfigAgent. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putVirtualMachineInstanceWithVMConfigAgent( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner().withProperties(new VirtualMachineInstanceProperties() + .withHardwareProfile( + new VirtualMachineInstancePropertiesHardwareProfile().withVmSize(VmSizeEnum.DEFAULT)) + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withOsProfile(new VirtualMachineInstancePropertiesOsProfile() + .withAdminPassword("fakeTokenPlaceholder") + .withAdminUsername("localadmin") + .withComputerName("luamaster") + .withWindowsConfiguration(new VirtualMachineInstancePropertiesOsProfileWindowsConfiguration() + .withProvisionVMConfigAgent(true))) + .withSecurityProfile(new VirtualMachineInstancePropertiesSecurityProfile().withEnableTPM(true) + .withUefiSettings(new VirtualMachineInstancePropertiesSecurityProfileUefiSettings() + .withSecureBootEnabled(true))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile() + .withImageReference(new ImageArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image")) + .withVmConfigStoragePathId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * 2025-06-01-preview/VirtualMachineInstances_CreateOrUpdate_Put_Virtual_Machine_Instance_With_Gpu.json + */ + /** + * Sample code: PutVirtualMachineInstanceWithGpu. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + putVirtualMachineInstanceWithGpu(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner() + .withProperties(new VirtualMachineInstanceProperties() + .withHardwareProfile( + new VirtualMachineInstancePropertiesHardwareProfile().withVmSize(VmSizeEnum.DEFAULT) + .withVirtualMachineGPUs(Arrays + .asList(new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPU_DDA) + .withPartitionSizeMB(0L)))) + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withOsProfile( + new VirtualMachineInstancePropertiesOsProfile().withAdminPassword("fakeTokenPlaceholder") + .withAdminUsername("localadmin") + .withComputerName("luamaster")) + .withSecurityProfile(new VirtualMachineInstancePropertiesSecurityProfile() + .withEnableTPM(true) + .withUefiSettings(new VirtualMachineInstancePropertiesSecurityProfileUefiSettings() + .withSecureBootEnabled(true))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile().withImageReference( + new ImageArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image")) + .withVmConfigStoragePathId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances__CreateOrUpdate_CreateFromLocal.json + */ + /** + * Sample code: CreateVirtualMachineInstanceFromLocal. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void createVirtualMachineInstanceFromLocal( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner().withProperties(new VirtualMachineInstanceProperties() + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile() + .withDataDisks(Arrays.asList(new VirtualHardDiskArmReference().withId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd")))) + .withCreateFromLocal(true)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualMachineInstances_Delete + +```java +/** + * Samples for VirtualMachineInstances Delete. + */ +public final class VirtualMachineInstancesDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Delete.json + */ + /** + * Sample code: DeleteVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void deleteVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .delete( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualMachineInstances_Get + +```java +/** + * Samples for VirtualMachineInstances Get. + */ +public final class VirtualMachineInstancesGetSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Get.json + */ + /** + * Sample code: GetVirtualMachineInstance. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + getVirtualMachineInstance(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .getWithResponse( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualMachineInstances_List + +```java +/** + * Samples for VirtualMachineInstances List. + */ +public final class VirtualMachineInstancesListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_List.json + */ + /** + * Sample code: ListVirtualMachineInstances. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listVirtualMachineInstances(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .list( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualMachineInstances_Pause + +```java +/** + * Samples for VirtualMachineInstances Pause. + */ +public final class VirtualMachineInstancesPauseSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Pause.json + */ + /** + * Sample code: PauseVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void pauseVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .pause( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualMachineInstances_Restart + +```java +/** + * Samples for VirtualMachineInstances Restart. + */ +public final class VirtualMachineInstancesRestartSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Restart.json + */ + /** + * Sample code: RestartVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + restartVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .restart( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualMachineInstances_Save + +```java +/** + * Samples for VirtualMachineInstances Save. + */ +public final class VirtualMachineInstancesSaveSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Save.json + */ + /** + * Sample code: SaveVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void saveVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .save( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualMachineInstances_Start + +```java +/** + * Samples for VirtualMachineInstances Start. + */ +public final class VirtualMachineInstancesStartSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Start.json + */ + /** + * Sample code: StartVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void startVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .start( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualMachineInstances_Stop + +```java +/** + * Samples for VirtualMachineInstances Stop. + */ +public final class VirtualMachineInstancesStopSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Stop.json + */ + /** + * Sample code: StopVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void stopVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .stop( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", + com.azure.core.util.Context.NONE); + } +} +``` + +### VirtualMachineInstances_Update + +```java +import com.azure.resourcemanager.azurestackhci.vm.models.StorageProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateRequest; +import java.util.Arrays; + +/** + * Samples for VirtualMachineInstances Update. + */ +public final class VirtualMachineInstancesUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Update.json + */ + /** + * Sample code: UpdateVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void updateVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .update( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceUpdateRequest() + .withProperties(new VirtualMachineInstanceUpdateProperties().withStorageProfile( + new StorageProfileUpdate().withDataDisks(Arrays.asList(new VirtualHardDiskArmReference().withId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"))))), + com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/pom.xml b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/pom.xml new file mode 100644 index 000000000000..1b07548f4bb9 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-azurestackhci-vm + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Azure Stack Hci Vm Management + This package contains Microsoft Azure SDK for Azure Stack Hci Vm Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Stack HCI management service. Package api-version 2025-06-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.56.0 + + + com.azure + azure-core-management + 1.19.0 + + + com.azure + azure-core-test + 1.27.0-beta.11 + test + + + com.azure + azure-identity + 1.17.0 + test + + + diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/AzureStackHciVmManager.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/AzureStackHciVmManager.java new file mode 100644 index 000000000000..9f1b405ae3b5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/AzureStackHciVmManager.java @@ -0,0 +1,461 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm; + +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.azurestackhci.vm.fluent.AzureStackHciVmMgmtClient; +import com.azure.resourcemanager.azurestackhci.vm.implementation.AttestationStatusesImpl; +import com.azure.resourcemanager.azurestackhci.vm.implementation.AzureStackHciVmMgmtClientBuilder; +import com.azure.resourcemanager.azurestackhci.vm.implementation.GalleryImagesImpl; +import com.azure.resourcemanager.azurestackhci.vm.implementation.GuestAgentsImpl; +import com.azure.resourcemanager.azurestackhci.vm.implementation.HybridIdentityMetadatasImpl; +import com.azure.resourcemanager.azurestackhci.vm.implementation.LogicalNetworksImpl; +import com.azure.resourcemanager.azurestackhci.vm.implementation.MarketplaceGalleryImagesImpl; +import com.azure.resourcemanager.azurestackhci.vm.implementation.NetworkInterfacesImpl; +import com.azure.resourcemanager.azurestackhci.vm.implementation.NetworkSecurityGroupsImpl; +import com.azure.resourcemanager.azurestackhci.vm.implementation.SecurityRulesImpl; +import com.azure.resourcemanager.azurestackhci.vm.implementation.StorageContainersImpl; +import com.azure.resourcemanager.azurestackhci.vm.implementation.VirtualHardDisksImpl; +import com.azure.resourcemanager.azurestackhci.vm.implementation.VirtualMachineInstancesImpl; +import com.azure.resourcemanager.azurestackhci.vm.models.AttestationStatuses; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImages; +import com.azure.resourcemanager.azurestackhci.vm.models.GuestAgents; +import com.azure.resourcemanager.azurestackhci.vm.models.HybridIdentityMetadatas; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworks; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImages; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaces; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroups; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRules; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainers; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisks; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstances; +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 AzureStackHciVmManager. + * Azure Stack HCI management service. + */ +public final class AzureStackHciVmManager { + private GalleryImages galleryImages; + + private LogicalNetworks logicalNetworks; + + private MarketplaceGalleryImages marketplaceGalleryImages; + + private NetworkInterfaces networkInterfaces; + + private NetworkSecurityGroups networkSecurityGroups; + + private SecurityRules securityRules; + + private StorageContainers storageContainers; + + private VirtualHardDisks virtualHardDisks; + + private VirtualMachineInstances virtualMachineInstances; + + private HybridIdentityMetadatas hybridIdentityMetadatas; + + private AttestationStatuses attestationStatuses; + + private GuestAgents guestAgents; + + private final AzureStackHciVmMgmtClient clientObject; + + private AzureStackHciVmManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new AzureStackHciVmMgmtClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Azure Stack Hci Vm service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Azure Stack Hci Vm service API instance. + */ + public static AzureStackHciVmManager 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 Azure Stack Hci Vm service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Azure Stack Hci Vm service API instance. + */ + public static AzureStackHciVmManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new AzureStackHciVmManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create AzureStackHciVmManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AzureStackHciVmManager.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-azurestackhci-vm.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 Azure Stack Hci Vm service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Azure Stack Hci Vm service API instance. + */ + public AzureStackHciVmManager 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.azurestackhci.vm") + .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 AzureStackHciVmManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of GalleryImages. It manages GalleryImage. + * + * @return Resource collection API of GalleryImages. + */ + public GalleryImages galleryImages() { + if (this.galleryImages == null) { + this.galleryImages = new GalleryImagesImpl(clientObject.getGalleryImages(), this); + } + return galleryImages; + } + + /** + * Gets the resource collection API of LogicalNetworks. It manages LogicalNetwork. + * + * @return Resource collection API of LogicalNetworks. + */ + public LogicalNetworks logicalNetworks() { + if (this.logicalNetworks == null) { + this.logicalNetworks = new LogicalNetworksImpl(clientObject.getLogicalNetworks(), this); + } + return logicalNetworks; + } + + /** + * Gets the resource collection API of MarketplaceGalleryImages. It manages MarketplaceGalleryImage. + * + * @return Resource collection API of MarketplaceGalleryImages. + */ + public MarketplaceGalleryImages marketplaceGalleryImages() { + if (this.marketplaceGalleryImages == null) { + this.marketplaceGalleryImages + = new MarketplaceGalleryImagesImpl(clientObject.getMarketplaceGalleryImages(), this); + } + return marketplaceGalleryImages; + } + + /** + * Gets the resource collection API of NetworkInterfaces. It manages NetworkInterface. + * + * @return Resource collection API of NetworkInterfaces. + */ + public NetworkInterfaces networkInterfaces() { + if (this.networkInterfaces == null) { + this.networkInterfaces = new NetworkInterfacesImpl(clientObject.getNetworkInterfaces(), this); + } + return networkInterfaces; + } + + /** + * Gets the resource collection API of NetworkSecurityGroups. It manages NetworkSecurityGroup. + * + * @return Resource collection API of NetworkSecurityGroups. + */ + public NetworkSecurityGroups networkSecurityGroups() { + if (this.networkSecurityGroups == null) { + this.networkSecurityGroups = new NetworkSecurityGroupsImpl(clientObject.getNetworkSecurityGroups(), this); + } + return networkSecurityGroups; + } + + /** + * Gets the resource collection API of SecurityRules. It manages SecurityRule. + * + * @return Resource collection API of SecurityRules. + */ + public SecurityRules securityRules() { + if (this.securityRules == null) { + this.securityRules = new SecurityRulesImpl(clientObject.getSecurityRules(), this); + } + return securityRules; + } + + /** + * Gets the resource collection API of StorageContainers. It manages StorageContainer. + * + * @return Resource collection API of StorageContainers. + */ + public StorageContainers storageContainers() { + if (this.storageContainers == null) { + this.storageContainers = new StorageContainersImpl(clientObject.getStorageContainers(), this); + } + return storageContainers; + } + + /** + * Gets the resource collection API of VirtualHardDisks. It manages VirtualHardDisk. + * + * @return Resource collection API of VirtualHardDisks. + */ + public VirtualHardDisks virtualHardDisks() { + if (this.virtualHardDisks == null) { + this.virtualHardDisks = new VirtualHardDisksImpl(clientObject.getVirtualHardDisks(), this); + } + return virtualHardDisks; + } + + /** + * Gets the resource collection API of VirtualMachineInstances. + * + * @return Resource collection API of VirtualMachineInstances. + */ + public VirtualMachineInstances virtualMachineInstances() { + if (this.virtualMachineInstances == null) { + this.virtualMachineInstances + = new VirtualMachineInstancesImpl(clientObject.getVirtualMachineInstances(), this); + } + return virtualMachineInstances; + } + + /** + * Gets the resource collection API of HybridIdentityMetadatas. + * + * @return Resource collection API of HybridIdentityMetadatas. + */ + public HybridIdentityMetadatas hybridIdentityMetadatas() { + if (this.hybridIdentityMetadatas == null) { + this.hybridIdentityMetadatas + = new HybridIdentityMetadatasImpl(clientObject.getHybridIdentityMetadatas(), this); + } + return hybridIdentityMetadatas; + } + + /** + * Gets the resource collection API of AttestationStatuses. + * + * @return Resource collection API of AttestationStatuses. + */ + public AttestationStatuses attestationStatuses() { + if (this.attestationStatuses == null) { + this.attestationStatuses = new AttestationStatusesImpl(clientObject.getAttestationStatuses(), this); + } + return attestationStatuses; + } + + /** + * Gets the resource collection API of GuestAgents. + * + * @return Resource collection API of GuestAgents. + */ + public GuestAgents guestAgents() { + if (this.guestAgents == null) { + this.guestAgents = new GuestAgentsImpl(clientObject.getGuestAgents(), this); + } + return guestAgents; + } + + /** + * Gets wrapped service client AzureStackHciVmMgmtClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client AzureStackHciVmMgmtClient. + */ + public AzureStackHciVmMgmtClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/AttestationStatusesClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/AttestationStatusesClient.java new file mode 100644 index 000000000000..dca4c8732cf5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/AttestationStatusesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.AttestationStatusInner; + +/** + * An instance of this class provides access to all the operations defined in AttestationStatusesClient. + */ +public interface AttestationStatusesClient { + /** + * Implements AttestationStatus GET method. + * + * @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 attestation status of the virtual machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, Context context); + + /** + * Implements AttestationStatus GET method. + * + * @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 attestation status of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationStatusInner get(String resourceUri); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/AzureStackHciVmMgmtClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/AzureStackHciVmMgmtClient.java new file mode 100644 index 000000000000..130b991866d4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/AzureStackHciVmMgmtClient.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for AzureStackHciVmMgmtClient class. + */ +public interface AzureStackHciVmMgmtClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the GalleryImagesClient object to access its operations. + * + * @return the GalleryImagesClient object. + */ + GalleryImagesClient getGalleryImages(); + + /** + * Gets the LogicalNetworksClient object to access its operations. + * + * @return the LogicalNetworksClient object. + */ + LogicalNetworksClient getLogicalNetworks(); + + /** + * Gets the MarketplaceGalleryImagesClient object to access its operations. + * + * @return the MarketplaceGalleryImagesClient object. + */ + MarketplaceGalleryImagesClient getMarketplaceGalleryImages(); + + /** + * Gets the NetworkInterfacesClient object to access its operations. + * + * @return the NetworkInterfacesClient object. + */ + NetworkInterfacesClient getNetworkInterfaces(); + + /** + * Gets the NetworkSecurityGroupsClient object to access its operations. + * + * @return the NetworkSecurityGroupsClient object. + */ + NetworkSecurityGroupsClient getNetworkSecurityGroups(); + + /** + * Gets the SecurityRulesClient object to access its operations. + * + * @return the SecurityRulesClient object. + */ + SecurityRulesClient getSecurityRules(); + + /** + * Gets the StorageContainersClient object to access its operations. + * + * @return the StorageContainersClient object. + */ + StorageContainersClient getStorageContainers(); + + /** + * Gets the VirtualHardDisksClient object to access its operations. + * + * @return the VirtualHardDisksClient object. + */ + VirtualHardDisksClient getVirtualHardDisks(); + + /** + * Gets the VirtualMachineInstancesClient object to access its operations. + * + * @return the VirtualMachineInstancesClient object. + */ + VirtualMachineInstancesClient getVirtualMachineInstances(); + + /** + * Gets the HybridIdentityMetadatasClient object to access its operations. + * + * @return the HybridIdentityMetadatasClient object. + */ + HybridIdentityMetadatasClient getHybridIdentityMetadatas(); + + /** + * Gets the AttestationStatusesClient object to access its operations. + * + * @return the AttestationStatusesClient object. + */ + AttestationStatusesClient getAttestationStatuses(); + + /** + * Gets the GuestAgentsClient object to access its operations. + * + * @return the GuestAgentsClient object. + */ + GuestAgentsClient getGuestAgents(); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/GalleryImagesClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/GalleryImagesClient.java new file mode 100644 index 000000000000..8ddbf6dafb15 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/GalleryImagesClient.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageTagsUpdate; + +/** + * An instance of this class provides access to all the operations defined in GalleryImagesClient. + */ +public interface GalleryImagesClient { + /** + * Gets a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 gallery image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String galleryImageName, + Context context); + + /** + * Gets a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 gallery image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageInner getByResourceGroup(String resourceGroupName, String galleryImageName); + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 the gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageInner> beginCreateOrUpdate(String resourceGroupName, + String galleryImageName, GalleryImageInner resource); + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 the gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageInner> beginCreateOrUpdate(String resourceGroupName, + String galleryImageName, GalleryImageInner resource, Context context); + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageInner createOrUpdate(String resourceGroupName, String galleryImageName, GalleryImageInner resource); + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageInner createOrUpdate(String resourceGroupName, String galleryImageName, GalleryImageInner resource, + Context context); + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 the gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageInner> beginUpdate(String resourceGroupName, + String galleryImageName, GalleryImageTagsUpdate properties); + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 the gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GalleryImageInner> beginUpdate(String resourceGroupName, + String galleryImageName, GalleryImageTagsUpdate properties, Context context); + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageInner update(String resourceGroupName, String galleryImageName, GalleryImageTagsUpdate properties); + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GalleryImageInner update(String resourceGroupName, String galleryImageName, GalleryImageTagsUpdate properties, + Context context); + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 galleryImageName); + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 galleryImageName, Context context); + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 galleryImageName); + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 galleryImageName, Context context); + + /** + * Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @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 GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @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 GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/GuestAgentsClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/GuestAgentsClient.java new file mode 100644 index 000000000000..673fad0318d5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/GuestAgentsClient.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.GuestAgentInner; + +/** + * An instance of this class provides access to all the operations defined in GuestAgentsClient. + */ +public interface GuestAgentsClient { + /** + * Implements GuestAgent GET method. + * + * @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 defines the GuestAgent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, Context context); + + /** + * Implements GuestAgent GET method. + * + * @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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GuestAgentInner get(String resourceUri); + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GuestAgentInner> beginCreate(String resourceUri, GuestAgentInner resource); + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, GuestAgentInner> beginCreate(String resourceUri, GuestAgentInner resource, + Context context); + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GuestAgentInner create(String resourceUri, GuestAgentInner resource); + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + GuestAgentInner create(String resourceUri, GuestAgentInner resource, Context context); + + /** + * Implements GuestAgent DELETE method. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri); + + /** + * Implements GuestAgent DELETE method. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri, Context context); + + /** + * Implements GuestAgent DELETE method. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri); + + /** + * Implements GuestAgent DELETE method. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, Context context); + + /** + * Returns the list of GuestAgent of the given vm. + * + * @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 GuestAgent list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVirtualMachineInstance(String resourceUri); + + /** + * Returns the list of GuestAgent of the given vm. + * + * @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 GuestAgent list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVirtualMachineInstance(String resourceUri, Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/HybridIdentityMetadatasClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/HybridIdentityMetadatasClient.java new file mode 100644 index 000000000000..f02de4524a8b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/HybridIdentityMetadatasClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.HybridIdentityMetadataInner; + +/** + * An instance of this class provides access to all the operations defined in HybridIdentityMetadatasClient. + */ +public interface HybridIdentityMetadatasClient { + /** + * Implements HybridIdentityMetadata GET method. + * + * @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 defines the HybridIdentityMetadata along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, Context context); + + /** + * Implements HybridIdentityMetadata GET method. + * + * @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 defines the HybridIdentityMetadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HybridIdentityMetadataInner get(String resourceUri); + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @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 HybridIdentityMetadata list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVirtualMachineInstance(String resourceUri); + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @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 HybridIdentityMetadata list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByVirtualMachineInstance(String resourceUri, Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/LogicalNetworksClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/LogicalNetworksClient.java new file mode 100644 index 000000000000..3673e9bd015e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/LogicalNetworksClient.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.LogicalNetworkInner; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworksUpdateRequest; + +/** + * An instance of this class provides access to all the operations defined in LogicalNetworksClient. + */ +public interface LogicalNetworksClient { + /** + * The operation to get a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logical network resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String logicalNetworkName, + Context context); + + /** + * The operation to get a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogicalNetworkInner getByResourceGroup(String resourceGroupName, String logicalNetworkName); + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LogicalNetworkInner> beginCreateOrUpdate(String resourceGroupName, + String logicalNetworkName, LogicalNetworkInner resource); + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LogicalNetworkInner> beginCreateOrUpdate(String resourceGroupName, + String logicalNetworkName, LogicalNetworkInner resource, Context context); + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogicalNetworkInner createOrUpdate(String resourceGroupName, String logicalNetworkName, + LogicalNetworkInner resource); + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogicalNetworkInner createOrUpdate(String resourceGroupName, String logicalNetworkName, + LogicalNetworkInner resource, Context context); + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LogicalNetworkInner> beginUpdate(String resourceGroupName, + String logicalNetworkName, LogicalNetworksUpdateRequest properties); + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LogicalNetworkInner> beginUpdate(String resourceGroupName, + String logicalNetworkName, LogicalNetworksUpdateRequest properties, Context context); + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogicalNetworkInner update(String resourceGroupName, String logicalNetworkName, + LogicalNetworksUpdateRequest properties); + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogicalNetworkInner update(String resourceGroupName, String logicalNetworkName, + LogicalNetworksUpdateRequest properties, Context context); + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 logicalNetworkName); + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 logicalNetworkName, + Context context); + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 logicalNetworkName); + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 logicalNetworkName, Context context); + + /** + * Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to + * get the next page of logical networks. + * + * @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 LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to + * get the next page of logical networks. + * + * @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 LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get + * the next page of logical networks. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get + * the next page of logical networks. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/MarketplaceGalleryImagesClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/MarketplaceGalleryImagesClient.java new file mode 100644 index 000000000000..4c738cbfff07 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/MarketplaceGalleryImagesClient.java @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.MarketplaceGalleryImageInner; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageTagsUpdate; + +/** + * An instance of this class provides access to all the operations defined in MarketplaceGalleryImagesClient. + */ +public interface MarketplaceGalleryImagesClient { + /** + * Gets a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 marketplace gallery image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String marketplaceGalleryImageName, Context context); + + /** + * Gets a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 marketplace gallery image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MarketplaceGalleryImageInner getByResourceGroup(String resourceGroupName, String marketplaceGalleryImageName); + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 the marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MarketplaceGalleryImageInner> beginCreateOrUpdate( + String resourceGroupName, String marketplaceGalleryImageName, MarketplaceGalleryImageInner resource); + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 the marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MarketplaceGalleryImageInner> beginCreateOrUpdate( + String resourceGroupName, String marketplaceGalleryImageName, MarketplaceGalleryImageInner resource, + Context context); + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MarketplaceGalleryImageInner createOrUpdate(String resourceGroupName, String marketplaceGalleryImageName, + MarketplaceGalleryImageInner resource); + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MarketplaceGalleryImageInner createOrUpdate(String resourceGroupName, String marketplaceGalleryImageName, + MarketplaceGalleryImageInner resource, Context context); + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 the marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MarketplaceGalleryImageInner> beginUpdate( + String resourceGroupName, String marketplaceGalleryImageName, MarketplaceGalleryImageTagsUpdate properties); + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 the marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MarketplaceGalleryImageInner> beginUpdate( + String resourceGroupName, String marketplaceGalleryImageName, MarketplaceGalleryImageTagsUpdate properties, + Context context); + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MarketplaceGalleryImageInner update(String resourceGroupName, String marketplaceGalleryImageName, + MarketplaceGalleryImageTagsUpdate properties); + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MarketplaceGalleryImageInner update(String resourceGroupName, String marketplaceGalleryImageName, + MarketplaceGalleryImageTagsUpdate properties, Context context); + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 marketplaceGalleryImageName); + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 marketplaceGalleryImageName, + Context context); + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 marketplaceGalleryImageName); + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 marketplaceGalleryImageName, Context context); + + /** + * Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @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 MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @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 MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/NetworkInterfacesClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/NetworkInterfacesClient.java new file mode 100644 index 000000000000..3a0217fe8b0a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/NetworkInterfacesClient.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.NetworkInterfaceInner; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfacesUpdateRequest; + +/** + * An instance of this class provides access to all the operations defined in NetworkInterfacesClient. + */ +public interface NetworkInterfacesClient { + /** + * Gets a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 network interface along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String networkInterfaceName, Context context); + + /** + * Gets a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 network interface. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkInterfaceInner getByResourceGroup(String resourceGroupName, String networkInterfaceName); + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 the network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkInterfaceInner> beginCreateOrUpdate(String resourceGroupName, + String networkInterfaceName, NetworkInterfaceInner resource); + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 the network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkInterfaceInner> beginCreateOrUpdate(String resourceGroupName, + String networkInterfaceName, NetworkInterfaceInner resource, Context context); + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkInterfaceInner createOrUpdate(String resourceGroupName, String networkInterfaceName, + NetworkInterfaceInner resource); + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkInterfaceInner createOrUpdate(String resourceGroupName, String networkInterfaceName, + NetworkInterfaceInner resource, Context context); + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 the network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkInterfaceInner> beginUpdate(String resourceGroupName, + String networkInterfaceName, NetworkInterfacesUpdateRequest properties); + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 the network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkInterfaceInner> beginUpdate(String resourceGroupName, + String networkInterfaceName, NetworkInterfacesUpdateRequest properties, Context context); + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkInterfaceInner update(String resourceGroupName, String networkInterfaceName, + NetworkInterfacesUpdateRequest properties); + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkInterfaceInner update(String resourceGroupName, String networkInterfaceName, + NetworkInterfacesUpdateRequest properties, Context context); + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 networkInterfaceName); + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 networkInterfaceName, + Context context); + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkInterfaceName); + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkInterfaceName, Context context); + + /** + * Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @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 NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @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 NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/NetworkSecurityGroupsClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/NetworkSecurityGroupsClient.java new file mode 100644 index 000000000000..301f3b7f8d5c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/NetworkSecurityGroupsClient.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.NetworkSecurityGroupInner; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupTagsUpdate; + +/** + * An instance of this class provides access to all the operations defined in NetworkSecurityGroupsClient. + */ +public interface NetworkSecurityGroupsClient { + /** + * Gets the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified network security group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String networkSecurityGroupName, Context context); + + /** + * Gets the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified network security group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkSecurityGroupInner getByResourceGroup(String resourceGroupName, String networkSecurityGroupName); + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkSecurityGroupInner> beginCreateOrUpdate( + String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner resource); + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkSecurityGroupInner> beginCreateOrUpdate( + String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner resource, Context context); + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkSecurityGroupInner createOrUpdate(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupInner resource); + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkSecurityGroupInner createOrUpdate(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupInner resource, Context context); + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkSecurityGroupInner> beginUpdateTags( + String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupTagsUpdate properties); + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NetworkSecurityGroupInner> beginUpdateTags( + String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupTagsUpdate properties, + Context context); + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkSecurityGroupInner updateTags(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupTagsUpdate properties); + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NetworkSecurityGroupInner updateTags(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupTagsUpdate properties, Context context); + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 networkSecurityGroupName); + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 networkSecurityGroupName, + Context context); + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkSecurityGroupName); + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkSecurityGroupName, Context context); + + /** + * Gets all network security groups in a 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 all network security groups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all network security groups in a 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 all network security groups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all network security groups in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all network security groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/SecurityRulesClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/SecurityRulesClient.java new file mode 100644 index 000000000000..8bf1e30bd173 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/SecurityRulesClient.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.SecurityRuleInner; + +/** + * An instance of this class provides access to all the operations defined in SecurityRulesClient. + */ +public interface SecurityRulesClient { + /** + * Gets the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified security rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName, Context context); + + /** + * Gets the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified security rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityRuleInner get(String resourceGroupName, String networkSecurityGroupName, String securityRuleName); + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SecurityRuleInner> beginCreateOrUpdate(String resourceGroupName, + String networkSecurityGroupName, String securityRuleName, SecurityRuleInner resource); + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SecurityRuleInner> beginCreateOrUpdate(String resourceGroupName, + String networkSecurityGroupName, String securityRuleName, SecurityRuleInner resource, Context context); + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityRuleInner createOrUpdate(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, + SecurityRuleInner resource); + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SecurityRuleInner createOrUpdate(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, + SecurityRuleInner resource, Context context); + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 networkSecurityGroupName, + String securityRuleName); + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 networkSecurityGroupName, + String securityRuleName, Context context); + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkSecurityGroupName, String securityRuleName); + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkSecurityGroupName, String securityRuleName, Context context); + + /** + * Gets all security rules in a Network Security Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByNetworkSecurityGroup(String resourceGroupName, + String networkSecurityGroupName); + + /** + * Gets all security rules in a Network Security Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByNetworkSecurityGroup(String resourceGroupName, + String networkSecurityGroupName, Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/StorageContainersClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/StorageContainersClient.java new file mode 100644 index 000000000000..f99ffccc2e68 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/StorageContainersClient.java @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.StorageContainerInner; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerTagsUpdate; + +/** + * An instance of this class provides access to all the operations defined in StorageContainersClient. + */ +public interface StorageContainersClient { + /** + * Gets a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 storage container along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String storageContainerName, Context context); + + /** + * Gets a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 storage container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageContainerInner getByResourceGroup(String resourceGroupName, String storageContainerName); + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 the storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageContainerInner> beginCreateOrUpdate(String resourceGroupName, + String storageContainerName, StorageContainerInner resource); + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 the storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageContainerInner> beginCreateOrUpdate(String resourceGroupName, + String storageContainerName, StorageContainerInner resource, Context context); + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageContainerInner createOrUpdate(String resourceGroupName, String storageContainerName, + StorageContainerInner resource); + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageContainerInner createOrUpdate(String resourceGroupName, String storageContainerName, + StorageContainerInner resource, Context context); + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 the storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageContainerInner> beginUpdate(String resourceGroupName, + String storageContainerName, StorageContainerTagsUpdate properties); + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 the storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageContainerInner> beginUpdate(String resourceGroupName, + String storageContainerName, StorageContainerTagsUpdate properties, Context context); + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageContainerInner update(String resourceGroupName, String storageContainerName, + StorageContainerTagsUpdate properties); + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageContainerInner update(String resourceGroupName, String storageContainerName, + StorageContainerTagsUpdate properties, Context context); + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 storageContainerName); + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 storageContainerName, + Context context); + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 storageContainerName); + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 storageContainerName, Context context); + + /** + * Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @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 StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @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 StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/VirtualHardDisksClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/VirtualHardDisksClient.java new file mode 100644 index 000000000000..b12052011e7c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/VirtualHardDisksClient.java @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.VirtualHardDiskInner; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskUploadResponseInner; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadRequest; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisksUpdateRequest; + +/** + * An instance of this class provides access to all the operations defined in VirtualHardDisksClient. + */ +public interface VirtualHardDisksClient { + /** + * Gets a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 virtual hard disk along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String virtualHardDiskName, + Context context); + + /** + * Gets a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 virtual hard disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualHardDiskInner getByResourceGroup(String resourceGroupName, String virtualHardDiskName); + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 the virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualHardDiskInner> beginCreateOrUpdate(String resourceGroupName, + String virtualHardDiskName, VirtualHardDiskInner resource); + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 the virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualHardDiskInner> beginCreateOrUpdate(String resourceGroupName, + String virtualHardDiskName, VirtualHardDiskInner resource, Context context); + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualHardDiskInner createOrUpdate(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskInner resource); + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualHardDiskInner createOrUpdate(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskInner resource, Context context); + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 the virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualHardDiskInner> beginUpdate(String resourceGroupName, + String virtualHardDiskName, VirtualHardDisksUpdateRequest properties); + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 the virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualHardDiskInner> beginUpdate(String resourceGroupName, + String virtualHardDiskName, VirtualHardDisksUpdateRequest properties, Context context); + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualHardDiskInner update(String resourceGroupName, String virtualHardDiskName, + VirtualHardDisksUpdateRequest properties); + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualHardDiskInner update(String resourceGroupName, String virtualHardDiskName, + VirtualHardDisksUpdateRequest properties, Context context); + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 virtualHardDiskName); + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is 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 virtualHardDiskName, + Context context); + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualHardDiskName); + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualHardDiskName, Context context); + + /** + * Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @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 VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @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 VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualHardDiskUploadResponseInner> + beginUpload(String resourceGroupName, String virtualHardDiskName, VirtualHardDiskUploadRequest body); + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualHardDiskUploadResponseInner> beginUpload( + String resourceGroupName, String virtualHardDiskName, VirtualHardDiskUploadRequest body, Context context); + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualHardDiskUploadResponseInner upload(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskUploadRequest body); + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualHardDiskUploadResponseInner upload(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskUploadRequest body, Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/VirtualMachineInstancesClient.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/VirtualMachineInstancesClient.java new file mode 100644 index 000000000000..b0df769b500f --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/VirtualMachineInstancesClient.java @@ -0,0 +1,476 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateRequest; + +/** + * An instance of this class provides access to all the operations defined in VirtualMachineInstancesClient. + */ +public interface VirtualMachineInstancesClient { + /** + * Gets a virtual machine instance. + * + * @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 a virtual machine instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, Context context); + + /** + * Gets a virtual machine instance. + * + * @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 a virtual machine instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInstanceInner get(String resourceUri); + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 the virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInstanceInner> + beginCreateOrUpdate(String resourceUri, VirtualMachineInstanceInner resource); + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 the virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInstanceInner> + beginCreateOrUpdate(String resourceUri, VirtualMachineInstanceInner resource, Context context); + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInstanceInner createOrUpdate(String resourceUri, VirtualMachineInstanceInner resource); + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInstanceInner createOrUpdate(String resourceUri, VirtualMachineInstanceInner resource, + Context context); + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 the virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInstanceInner> beginUpdate(String resourceUri, + VirtualMachineInstanceUpdateRequest properties); + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 the virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, VirtualMachineInstanceInner> beginUpdate(String resourceUri, + VirtualMachineInstanceUpdateRequest properties, Context context); + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInstanceInner update(String resourceUri, VirtualMachineInstanceUpdateRequest properties); + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualMachineInstanceInner update(String resourceUri, VirtualMachineInstanceUpdateRequest properties, + Context context); + + /** + * The operation to delete a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri); + + /** + * The operation to delete a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceUri, Context context); + + /** + * The operation to delete a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri); + + /** + * The operation to delete a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, Context context); + + /** + * Lists all of the virtual machine instances within the specified parent resource. + * + * @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 VirtualMachineInstance list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * Lists all of the virtual machine instances within the specified parent resource. + * + * @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 VirtualMachineInstance list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, Context context); + + /** + * The operation to start a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceUri); + + /** + * The operation to start a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStart(String resourceUri, Context context); + + /** + * The operation to start a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceUri); + + /** + * The operation to start a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceUri, Context context); + + /** + * The operation to stop a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStop(String resourceUri); + + /** + * The operation to stop a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginStop(String resourceUri, Context context); + + /** + * The operation to stop a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceUri); + + /** + * The operation to stop a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceUri, Context context); + + /** + * The operation to restart a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceUri); + + /** + * The operation to restart a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginRestart(String resourceUri, Context context); + + /** + * The operation to restart a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceUri); + + /** + * The operation to restart a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceUri, Context context); + + /** + * The operation to pause a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPause(String resourceUri); + + /** + * The operation to pause a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginPause(String resourceUri, Context context); + + /** + * The operation to pause a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void pause(String resourceUri); + + /** + * The operation to pause a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void pause(String resourceUri, Context context); + + /** + * The operation to save a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginSave(String resourceUri); + + /** + * The operation to save a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginSave(String resourceUri, Context context); + + /** + * The operation to save a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void save(String resourceUri); + + /** + * The operation to save a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void save(String resourceUri, Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/AttestationStatusInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/AttestationStatusInner.java new file mode 100644 index 000000000000..51d660e03438 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/AttestationStatusInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.fluent.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.models.AttestationStatusProperties; +import java.io.IOException; + +/** + * The attestation status of the virtual machine. + */ +@Immutable +public final class AttestationStatusInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private AttestationStatusProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AttestationStatusInner class. + */ + private AttestationStatusInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public AttestationStatusProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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 AttestationStatusInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AttestationStatusInner 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 AttestationStatusInner. + */ + public static AttestationStatusInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AttestationStatusInner deserializedAttestationStatusInner = new AttestationStatusInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAttestationStatusInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAttestationStatusInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAttestationStatusInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedAttestationStatusInner.properties = AttestationStatusProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAttestationStatusInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAttestationStatusInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/GalleryImageInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/GalleryImageInner.java new file mode 100644 index 000000000000..84ff92f68524 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/GalleryImageInner.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The gallery images resource definition. + */ +@Fluent +public final class GalleryImageInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private GalleryImageProperties properties; + + /* + * The extendedLocation of the resource. + */ + private ExtendedLocation extendedLocation; + + /* + * 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 GalleryImageInner class. + */ + public GalleryImageInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public GalleryImageProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withProperties(GalleryImageProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extendedLocation of the resource. + * + * @param extendedLocation the extendedLocation value to set. + * @return the GalleryImageInner object itself. + */ + public GalleryImageInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + 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 GalleryImageInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public GalleryImageInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().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.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GalleryImageInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryImageInner 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 GalleryImageInner. + */ + public static GalleryImageInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryImageInner deserializedGalleryImageInner = new GalleryImageInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGalleryImageInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGalleryImageInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGalleryImageInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedGalleryImageInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedGalleryImageInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedGalleryImageInner.properties = GalleryImageProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedGalleryImageInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedGalleryImageInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryImageInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/GalleryImageVersionProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/GalleryImageVersionProperties.java new file mode 100644 index 000000000000..81044449c0a8 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/GalleryImageVersionProperties.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.GalleryImageVersionStorageProfile; +import java.io.IOException; + +/** + * Describes the properties of a gallery image version. + */ +@Fluent +public final class GalleryImageVersionProperties implements JsonSerializable { + /* + * This is the storage profile of a Gallery Image Version. + */ + private GalleryImageVersionStorageProfile storageProfile; + + /** + * Creates an instance of GalleryImageVersionProperties class. + */ + public GalleryImageVersionProperties() { + } + + /** + * Get the storageProfile property: This is the storage profile of a Gallery Image Version. + * + * @return the storageProfile value. + */ + public GalleryImageVersionStorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: This is the storage profile of a Gallery Image Version. + * + * @param storageProfile the storageProfile value to set. + * @return the GalleryImageVersionProperties object itself. + */ + public GalleryImageVersionProperties withStorageProfile(GalleryImageVersionStorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageProfile() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property storageProfile in model GalleryImageVersionProperties")); + } else { + storageProfile().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GalleryImageVersionProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("storageProfile", this.storageProfile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GalleryImageVersionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryImageVersionProperties 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 GalleryImageVersionProperties. + */ + public static GalleryImageVersionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryImageVersionProperties deserializedGalleryImageVersionProperties + = new GalleryImageVersionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageProfile".equals(fieldName)) { + deserializedGalleryImageVersionProperties.storageProfile + = GalleryImageVersionStorageProfile.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryImageVersionProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/GuestAgentInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/GuestAgentInner.java new file mode 100644 index 000000000000..3d0abfc98431 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/GuestAgentInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.GuestAgentProperties; +import java.io.IOException; + +/** + * Defines the GuestAgent. + */ +@Fluent +public final class GuestAgentInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private GuestAgentProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of GuestAgentInner class. + */ + public GuestAgentInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public GuestAgentProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the GuestAgentInner object itself. + */ + public GuestAgentInner withProperties(GuestAgentProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * 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 GuestAgentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GuestAgentInner 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 GuestAgentInner. + */ + public static GuestAgentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GuestAgentInner deserializedGuestAgentInner = new GuestAgentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedGuestAgentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedGuestAgentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedGuestAgentInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedGuestAgentInner.properties = GuestAgentProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedGuestAgentInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGuestAgentInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/HybridIdentityMetadataInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/HybridIdentityMetadataInner.java new file mode 100644 index 000000000000..1a7ce787757b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/HybridIdentityMetadataInner.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.fluent.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.models.HybridIdentityMetadataProperties; +import java.io.IOException; + +/** + * Defines the HybridIdentityMetadata. + */ +@Immutable +public final class HybridIdentityMetadataInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private HybridIdentityMetadataProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of HybridIdentityMetadataInner class. + */ + private HybridIdentityMetadataInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public HybridIdentityMetadataProperties properties() { + return this.properties; + } + + /** + * 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; + } + + /** + * 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 HybridIdentityMetadataInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HybridIdentityMetadataInner 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 HybridIdentityMetadataInner. + */ + public static HybridIdentityMetadataInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HybridIdentityMetadataInner deserializedHybridIdentityMetadataInner = new HybridIdentityMetadataInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedHybridIdentityMetadataInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedHybridIdentityMetadataInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedHybridIdentityMetadataInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedHybridIdentityMetadataInner.properties + = HybridIdentityMetadataProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedHybridIdentityMetadataInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedHybridIdentityMetadataInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/LogicalNetworkInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/LogicalNetworkInner.java new file mode 100644 index 000000000000..e29179f4763f --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/LogicalNetworkInner.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The logical network resource definition. + */ +@Fluent +public final class LogicalNetworkInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private LogicalNetworkProperties properties; + + /* + * The extendedLocation of the resource. + */ + private ExtendedLocation extendedLocation; + + /* + * 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 LogicalNetworkInner class. + */ + public LogicalNetworkInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public LogicalNetworkProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the LogicalNetworkInner object itself. + */ + public LogicalNetworkInner withProperties(LogicalNetworkProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extendedLocation of the resource. + * + * @param extendedLocation the extendedLocation value to set. + * @return the LogicalNetworkInner object itself. + */ + public LogicalNetworkInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + 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 LogicalNetworkInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public LogicalNetworkInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().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.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogicalNetworkInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogicalNetworkInner 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 LogicalNetworkInner. + */ + public static LogicalNetworkInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogicalNetworkInner deserializedLogicalNetworkInner = new LogicalNetworkInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedLogicalNetworkInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedLogicalNetworkInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedLogicalNetworkInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedLogicalNetworkInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedLogicalNetworkInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedLogicalNetworkInner.properties = LogicalNetworkProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedLogicalNetworkInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedLogicalNetworkInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLogicalNetworkInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/MarketplaceGalleryImageInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/MarketplaceGalleryImageInner.java new file mode 100644 index 000000000000..fa8e6f7a1754 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/MarketplaceGalleryImageInner.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The marketplace gallery image resource definition. + */ +@Fluent +public final class MarketplaceGalleryImageInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private MarketplaceGalleryImageProperties properties; + + /* + * The extendedLocation of the resource. + */ + private ExtendedLocation extendedLocation; + + /* + * 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 MarketplaceGalleryImageInner class. + */ + public MarketplaceGalleryImageInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public MarketplaceGalleryImageProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the MarketplaceGalleryImageInner object itself. + */ + public MarketplaceGalleryImageInner withProperties(MarketplaceGalleryImageProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extendedLocation of the resource. + * + * @param extendedLocation the extendedLocation value to set. + * @return the MarketplaceGalleryImageInner object itself. + */ + public MarketplaceGalleryImageInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + 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 MarketplaceGalleryImageInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MarketplaceGalleryImageInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().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.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketplaceGalleryImageInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceGalleryImageInner 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 MarketplaceGalleryImageInner. + */ + public static MarketplaceGalleryImageInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceGalleryImageInner deserializedMarketplaceGalleryImageInner = new MarketplaceGalleryImageInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMarketplaceGalleryImageInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMarketplaceGalleryImageInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMarketplaceGalleryImageInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedMarketplaceGalleryImageInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMarketplaceGalleryImageInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedMarketplaceGalleryImageInner.properties + = MarketplaceGalleryImageProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedMarketplaceGalleryImageInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedMarketplaceGalleryImageInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceGalleryImageInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/NetworkInterfaceInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/NetworkInterfaceInner.java new file mode 100644 index 000000000000..c3f792adffa6 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/NetworkInterfaceInner.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The network interface resource definition. + */ +@Fluent +public final class NetworkInterfaceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private NetworkInterfaceProperties properties; + + /* + * The extendedLocation of the resource. + */ + private ExtendedLocation extendedLocation; + + /* + * 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 NetworkInterfaceInner class. + */ + public NetworkInterfaceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public NetworkInterfaceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the NetworkInterfaceInner object itself. + */ + public NetworkInterfaceInner withProperties(NetworkInterfaceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extendedLocation of the resource. + * + * @param extendedLocation the extendedLocation value to set. + * @return the NetworkInterfaceInner object itself. + */ + public NetworkInterfaceInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + 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 NetworkInterfaceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public NetworkInterfaceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().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.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkInterfaceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkInterfaceInner 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 NetworkInterfaceInner. + */ + public static NetworkInterfaceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkInterfaceInner deserializedNetworkInterfaceInner = new NetworkInterfaceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNetworkInterfaceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNetworkInterfaceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNetworkInterfaceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedNetworkInterfaceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedNetworkInterfaceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedNetworkInterfaceInner.properties = NetworkInterfaceProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedNetworkInterfaceInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedNetworkInterfaceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkInterfaceInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/NetworkSecurityGroupInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/NetworkSecurityGroupInner.java new file mode 100644 index 000000000000..350656c34730 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/NetworkSecurityGroupInner.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupProperties; +import java.io.IOException; +import java.util.Map; + +/** + * NetworkSecurityGroup resource. + */ +@Fluent +public final class NetworkSecurityGroupInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private NetworkSecurityGroupProperties properties; + + /* + * The extendedLocation of the resource. + */ + private ExtendedLocation extendedLocation; + + /* + * If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. + * Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity + * tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section + * 14.27) header fields. + */ + private String eTag; + + /* + * 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 NetworkSecurityGroupInner class. + */ + public NetworkSecurityGroupInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public NetworkSecurityGroupProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the NetworkSecurityGroupInner object itself. + */ + public NetworkSecurityGroupInner withProperties(NetworkSecurityGroupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extendedLocation of the resource. + * + * @param extendedLocation the extendedLocation value to set. + * @return the NetworkSecurityGroupInner object itself. + */ + public NetworkSecurityGroupInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * Get the eTag property: If eTag is provided in the response body, it may also be provided as a header per the + * normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. + * HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), + * and If-Range (section 14.27) header fields. + * + * @return the eTag value. + */ + public String eTag() { + return this.eTag; + } + + /** + * 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 NetworkSecurityGroupInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public NetworkSecurityGroupInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().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.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkSecurityGroupInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkSecurityGroupInner 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 NetworkSecurityGroupInner. + */ + public static NetworkSecurityGroupInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkSecurityGroupInner deserializedNetworkSecurityGroupInner = new NetworkSecurityGroupInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNetworkSecurityGroupInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNetworkSecurityGroupInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNetworkSecurityGroupInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedNetworkSecurityGroupInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedNetworkSecurityGroupInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedNetworkSecurityGroupInner.properties = NetworkSecurityGroupProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedNetworkSecurityGroupInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("eTag".equals(fieldName)) { + deserializedNetworkSecurityGroupInner.eTag = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedNetworkSecurityGroupInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkSecurityGroupInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/RouteProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/RouteProperties.java new file mode 100644 index 000000000000..3a798eedeb73 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/RouteProperties.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * RoutePropertiesFormat - Route resource. + */ +@Fluent +public final class RouteProperties implements JsonSerializable { + /* + * The destination CIDR to which the route applies. + */ + private String addressPrefix; + + /* + * The IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type + * is VirtualAppliance. + */ + private String nextHopIpAddress; + + /** + * Creates an instance of RouteProperties class. + */ + public RouteProperties() { + } + + /** + * Get the addressPrefix property: The destination CIDR to which the route applies. + * + * @return the addressPrefix value. + */ + public String addressPrefix() { + return this.addressPrefix; + } + + /** + * Set the addressPrefix property: The destination CIDR to which the route applies. + * + * @param addressPrefix the addressPrefix value to set. + * @return the RouteProperties object itself. + */ + public RouteProperties withAddressPrefix(String addressPrefix) { + this.addressPrefix = addressPrefix; + return this; + } + + /** + * Get the nextHopIpAddress property: The IP address packets should be forwarded to. Next hop values are only + * allowed in routes where the next hop type is VirtualAppliance. + * + * @return the nextHopIpAddress value. + */ + public String nextHopIpAddress() { + return this.nextHopIpAddress; + } + + /** + * Set the nextHopIpAddress property: The IP address packets should be forwarded to. Next hop values are only + * allowed in routes where the next hop type is VirtualAppliance. + * + * @param nextHopIpAddress the nextHopIpAddress value to set. + * @return the RouteProperties object itself. + */ + public RouteProperties withNextHopIpAddress(String nextHopIpAddress) { + this.nextHopIpAddress = nextHopIpAddress; + 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("addressPrefix", this.addressPrefix); + jsonWriter.writeStringField("nextHopIpAddress", this.nextHopIpAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RouteProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RouteProperties 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 RouteProperties. + */ + public static RouteProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RouteProperties deserializedRouteProperties = new RouteProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("addressPrefix".equals(fieldName)) { + deserializedRouteProperties.addressPrefix = reader.getString(); + } else if ("nextHopIpAddress".equals(fieldName)) { + deserializedRouteProperties.nextHopIpAddress = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRouteProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/RouteTableProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/RouteTableProperties.java new file mode 100644 index 000000000000..a498d6e3f4c3 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/RouteTableProperties.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.Route; +import java.io.IOException; +import java.util.List; + +/** + * RouteTablePropertiesFormat - Route Table resource. + */ +@Fluent +public final class RouteTableProperties implements JsonSerializable { + /* + * Collection of routes contained within a route table. + */ + private List routes; + + /** + * Creates an instance of RouteTableProperties class. + */ + public RouteTableProperties() { + } + + /** + * Get the routes property: Collection of routes contained within a route table. + * + * @return the routes value. + */ + public List routes() { + return this.routes; + } + + /** + * Set the routes property: Collection of routes contained within a route table. + * + * @param routes the routes value to set. + * @return the RouteTableProperties object itself. + */ + public RouteTableProperties withRoutes(List routes) { + this.routes = routes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (routes() != null) { + routes().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("routes", this.routes, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RouteTableProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RouteTableProperties 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 RouteTableProperties. + */ + public static RouteTableProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RouteTableProperties deserializedRouteTableProperties = new RouteTableProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("routes".equals(fieldName)) { + List routes = reader.readArray(reader1 -> Route.fromJson(reader1)); + deserializedRouteTableProperties.routes = routes; + } else { + reader.skipChildren(); + } + } + + return deserializedRouteTableProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/SecurityRuleInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/SecurityRuleInner.java new file mode 100644 index 000000000000..2971d5a6b5bf --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/SecurityRuleInner.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProperties; +import java.io.IOException; + +/** + * Security Rule resource. + */ +@Fluent +public final class SecurityRuleInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private SecurityRuleProperties properties; + + /* + * The extendedLocation of the resource. + */ + private ExtendedLocation extendedLocation; + + /* + * 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 SecurityRuleInner class. + */ + public SecurityRuleInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SecurityRuleProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SecurityRuleInner object itself. + */ + public SecurityRuleInner withProperties(SecurityRuleProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extendedLocation of the resource. + * + * @param extendedLocation the extendedLocation value to set. + * @return the SecurityRuleInner object itself. + */ + public SecurityRuleInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityRuleInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityRuleInner 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 SecurityRuleInner. + */ + public static SecurityRuleInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityRuleInner deserializedSecurityRuleInner = new SecurityRuleInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSecurityRuleInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSecurityRuleInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecurityRuleInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedSecurityRuleInner.properties = SecurityRuleProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedSecurityRuleInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSecurityRuleInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityRuleInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/StorageContainerInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/StorageContainerInner.java new file mode 100644 index 000000000000..24eaea942799 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/StorageContainerInner.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The storage container resource definition. + */ +@Fluent +public final class StorageContainerInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private StorageContainerProperties properties; + + /* + * The extendedLocation of the resource. + */ + private ExtendedLocation extendedLocation; + + /* + * 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 StorageContainerInner class. + */ + public StorageContainerInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public StorageContainerProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the StorageContainerInner object itself. + */ + public StorageContainerInner withProperties(StorageContainerProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extendedLocation of the resource. + * + * @param extendedLocation the extendedLocation value to set. + * @return the StorageContainerInner object itself. + */ + public StorageContainerInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + 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 StorageContainerInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public StorageContainerInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().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.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageContainerInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageContainerInner 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 StorageContainerInner. + */ + public static StorageContainerInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageContainerInner deserializedStorageContainerInner = new StorageContainerInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedStorageContainerInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedStorageContainerInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedStorageContainerInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedStorageContainerInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedStorageContainerInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedStorageContainerInner.properties = StorageContainerProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedStorageContainerInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedStorageContainerInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageContainerInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/SubnetProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/SubnetProperties.java new file mode 100644 index 000000000000..b64ecb7ae5b0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/SubnetProperties.java @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.IPPool; +import com.azure.resourcemanager.azurestackhci.vm.models.IpAllocationMethodEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.RouteTable; +import com.azure.resourcemanager.azurestackhci.vm.models.SubnetIpConfigurationReference; +import java.io.IOException; +import java.util.List; + +/** + * Properties of the subnet. + */ +@Fluent +public final class SubnetProperties implements JsonSerializable { + /* + * The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + */ + private String addressPrefix; + + /* + * List of address prefixes for the subnet. + */ + private List addressPrefixes; + + /* + * IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic' + */ + private IpAllocationMethodEnum ipAllocationMethod; + + /* + * IPConfigurationReferences - list of IPConfigurationReferences + */ + private List ipConfigurationReferences; + + /* + * NetworkSecurityGroup - Network Security Group attached to the logical network. + */ + private NetworkSecurityGroupArmReference networkSecurityGroup; + + /* + * Route table resource. + */ + private RouteTable routeTable; + + /* + * network associated pool of IP Addresses + */ + private List ipPools; + + /* + * Vlan to use for the subnet + */ + private Integer vlan; + + /** + * Creates an instance of SubnetProperties class. + */ + public SubnetProperties() { + } + + /** + * Get the addressPrefix property: The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + * + * @return the addressPrefix value. + */ + public String addressPrefix() { + return this.addressPrefix; + } + + /** + * Set the addressPrefix property: The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + * + * @param addressPrefix the addressPrefix value to set. + * @return the SubnetProperties object itself. + */ + public SubnetProperties withAddressPrefix(String addressPrefix) { + this.addressPrefix = addressPrefix; + return this; + } + + /** + * Get the addressPrefixes property: List of address prefixes for the subnet. + * + * @return the addressPrefixes value. + */ + public List addressPrefixes() { + return this.addressPrefixes; + } + + /** + * Set the addressPrefixes property: List of address prefixes for the subnet. + * + * @param addressPrefixes the addressPrefixes value to set. + * @return the SubnetProperties object itself. + */ + public SubnetProperties withAddressPrefixes(List addressPrefixes) { + this.addressPrefixes = addressPrefixes; + return this; + } + + /** + * Get the ipAllocationMethod property: IPAllocationMethod - The IP address allocation method. Possible values + * include: 'Static', 'Dynamic'. + * + * @return the ipAllocationMethod value. + */ + public IpAllocationMethodEnum ipAllocationMethod() { + return this.ipAllocationMethod; + } + + /** + * Set the ipAllocationMethod property: IPAllocationMethod - The IP address allocation method. Possible values + * include: 'Static', 'Dynamic'. + * + * @param ipAllocationMethod the ipAllocationMethod value to set. + * @return the SubnetProperties object itself. + */ + public SubnetProperties withIpAllocationMethod(IpAllocationMethodEnum ipAllocationMethod) { + this.ipAllocationMethod = ipAllocationMethod; + return this; + } + + /** + * Get the ipConfigurationReferences property: IPConfigurationReferences - list of IPConfigurationReferences. + * + * @return the ipConfigurationReferences value. + */ + public List ipConfigurationReferences() { + return this.ipConfigurationReferences; + } + + /** + * Set the ipConfigurationReferences property: IPConfigurationReferences - list of IPConfigurationReferences. + * + * @param ipConfigurationReferences the ipConfigurationReferences value to set. + * @return the SubnetProperties object itself. + */ + public SubnetProperties + withIpConfigurationReferences(List ipConfigurationReferences) { + this.ipConfigurationReferences = ipConfigurationReferences; + return this; + } + + /** + * Get the networkSecurityGroup property: NetworkSecurityGroup - Network Security Group attached to the logical + * network. + * + * @return the networkSecurityGroup value. + */ + public NetworkSecurityGroupArmReference networkSecurityGroup() { + return this.networkSecurityGroup; + } + + /** + * Set the networkSecurityGroup property: NetworkSecurityGroup - Network Security Group attached to the logical + * network. + * + * @param networkSecurityGroup the networkSecurityGroup value to set. + * @return the SubnetProperties object itself. + */ + public SubnetProperties withNetworkSecurityGroup(NetworkSecurityGroupArmReference networkSecurityGroup) { + this.networkSecurityGroup = networkSecurityGroup; + return this; + } + + /** + * Get the routeTable property: Route table resource. + * + * @return the routeTable value. + */ + public RouteTable routeTable() { + return this.routeTable; + } + + /** + * Set the routeTable property: Route table resource. + * + * @param routeTable the routeTable value to set. + * @return the SubnetProperties object itself. + */ + public SubnetProperties withRouteTable(RouteTable routeTable) { + this.routeTable = routeTable; + return this; + } + + /** + * Get the ipPools property: network associated pool of IP Addresses. + * + * @return the ipPools value. + */ + public List ipPools() { + return this.ipPools; + } + + /** + * Set the ipPools property: network associated pool of IP Addresses. + * + * @param ipPools the ipPools value to set. + * @return the SubnetProperties object itself. + */ + public SubnetProperties withIpPools(List ipPools) { + this.ipPools = ipPools; + return this; + } + + /** + * Get the vlan property: Vlan to use for the subnet. + * + * @return the vlan value. + */ + public Integer vlan() { + return this.vlan; + } + + /** + * Set the vlan property: Vlan to use for the subnet. + * + * @param vlan the vlan value to set. + * @return the SubnetProperties object itself. + */ + public SubnetProperties withVlan(Integer vlan) { + this.vlan = vlan; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipConfigurationReferences() != null) { + ipConfigurationReferences().forEach(e -> e.validate()); + } + if (networkSecurityGroup() != null) { + networkSecurityGroup().validate(); + } + if (routeTable() != null) { + routeTable().validate(); + } + if (ipPools() != null) { + ipPools().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("addressPrefix", this.addressPrefix); + jsonWriter.writeArrayField("addressPrefixes", this.addressPrefixes, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("ipAllocationMethod", + this.ipAllocationMethod == null ? null : this.ipAllocationMethod.toString()); + jsonWriter.writeArrayField("ipConfigurationReferences", this.ipConfigurationReferences, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("networkSecurityGroup", this.networkSecurityGroup); + jsonWriter.writeJsonField("routeTable", this.routeTable); + jsonWriter.writeArrayField("ipPools", this.ipPools, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("vlan", this.vlan); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubnetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubnetProperties 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 SubnetProperties. + */ + public static SubnetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubnetProperties deserializedSubnetProperties = new SubnetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("addressPrefix".equals(fieldName)) { + deserializedSubnetProperties.addressPrefix = reader.getString(); + } else if ("addressPrefixes".equals(fieldName)) { + List addressPrefixes = reader.readArray(reader1 -> reader1.getString()); + deserializedSubnetProperties.addressPrefixes = addressPrefixes; + } else if ("ipAllocationMethod".equals(fieldName)) { + deserializedSubnetProperties.ipAllocationMethod + = IpAllocationMethodEnum.fromString(reader.getString()); + } else if ("ipConfigurationReferences".equals(fieldName)) { + List ipConfigurationReferences + = reader.readArray(reader1 -> SubnetIpConfigurationReference.fromJson(reader1)); + deserializedSubnetProperties.ipConfigurationReferences = ipConfigurationReferences; + } else if ("networkSecurityGroup".equals(fieldName)) { + deserializedSubnetProperties.networkSecurityGroup + = NetworkSecurityGroupArmReference.fromJson(reader); + } else if ("routeTable".equals(fieldName)) { + deserializedSubnetProperties.routeTable = RouteTable.fromJson(reader); + } else if ("ipPools".equals(fieldName)) { + List ipPools = reader.readArray(reader1 -> IPPool.fromJson(reader1)); + deserializedSubnetProperties.ipPools = ipPools; + } else if ("vlan".equals(fieldName)) { + deserializedSubnetProperties.vlan = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSubnetProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/VirtualHardDiskInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/VirtualHardDiskInner.java new file mode 100644 index 000000000000..a4ef1986655a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/VirtualHardDiskInner.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The virtual hard disk resource definition. + */ +@Fluent +public final class VirtualHardDiskInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private VirtualHardDiskProperties properties; + + /* + * The extendedLocation of the resource. + */ + private ExtendedLocation extendedLocation; + + /* + * 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 VirtualHardDiskInner class. + */ + public VirtualHardDiskInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public VirtualHardDiskProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the VirtualHardDiskInner object itself. + */ + public VirtualHardDiskInner withProperties(VirtualHardDiskProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extendedLocation of the resource. + * + * @param extendedLocation the extendedLocation value to set. + * @return the VirtualHardDiskInner object itself. + */ + public VirtualHardDiskInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + 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 VirtualHardDiskInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public VirtualHardDiskInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().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.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDiskInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDiskInner 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 VirtualHardDiskInner. + */ + public static VirtualHardDiskInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDiskInner deserializedVirtualHardDiskInner = new VirtualHardDiskInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedVirtualHardDiskInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedVirtualHardDiskInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedVirtualHardDiskInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedVirtualHardDiskInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedVirtualHardDiskInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedVirtualHardDiskInner.properties = VirtualHardDiskProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedVirtualHardDiskInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedVirtualHardDiskInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDiskInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/VirtualHardDiskUploadResponseInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/VirtualHardDiskUploadResponseInner.java new file mode 100644 index 000000000000..fe090c8c6a90 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/VirtualHardDiskUploadResponseInner.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadStatus; +import java.io.IOException; + +/** + * Response for uploading virtual hard disk. + */ +@Immutable +public final class VirtualHardDiskUploadResponseInner implements JsonSerializable { + /* + * The ARM ID for a Virtual Hard Disk. + */ + private String virtualHardDiskId; + + /* + * The upload status of the virtual hard disk + */ + private VirtualHardDiskUploadStatus uploadStatus; + + /** + * Creates an instance of VirtualHardDiskUploadResponseInner class. + */ + private VirtualHardDiskUploadResponseInner() { + } + + /** + * Get the virtualHardDiskId property: The ARM ID for a Virtual Hard Disk. + * + * @return the virtualHardDiskId value. + */ + public String virtualHardDiskId() { + return this.virtualHardDiskId; + } + + /** + * Get the uploadStatus property: The upload status of the virtual hard disk. + * + * @return the uploadStatus value. + */ + public VirtualHardDiskUploadStatus uploadStatus() { + return this.uploadStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (uploadStatus() != null) { + uploadStatus().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("virtualHardDiskId", this.virtualHardDiskId); + jsonWriter.writeJsonField("uploadStatus", this.uploadStatus); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDiskUploadResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDiskUploadResponseInner 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 VirtualHardDiskUploadResponseInner. + */ + public static VirtualHardDiskUploadResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDiskUploadResponseInner deserializedVirtualHardDiskUploadResponseInner + = new VirtualHardDiskUploadResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("virtualHardDiskId".equals(fieldName)) { + deserializedVirtualHardDiskUploadResponseInner.virtualHardDiskId = reader.getString(); + } else if ("uploadStatus".equals(fieldName)) { + deserializedVirtualHardDiskUploadResponseInner.uploadStatus + = VirtualHardDiskUploadStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDiskUploadResponseInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/VirtualMachineInstanceInner.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/VirtualMachineInstanceInner.java new file mode 100644 index 000000000000..413dcfa477ae --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/VirtualMachineInstanceInner.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ManagedServiceIdentity; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceProperties; +import java.io.IOException; + +/** + * The virtual machine instance resource definition. + */ +@Fluent +public final class VirtualMachineInstanceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private VirtualMachineInstanceProperties properties; + + /* + * The extendedLocation of the resource. + */ + private ExtendedLocation extendedLocation; + + /* + * 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 VirtualMachineInstanceInner class. + */ + public VirtualMachineInstanceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public VirtualMachineInstanceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the VirtualMachineInstanceInner object itself. + */ + public VirtualMachineInstanceInner withProperties(VirtualMachineInstanceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + public ExtendedLocation extendedLocation() { + return this.extendedLocation; + } + + /** + * Set the extendedLocation property: The extendedLocation of the resource. + * + * @param extendedLocation the extendedLocation value to set. + * @return the VirtualMachineInstanceInner object itself. + */ + public VirtualMachineInstanceInner withExtendedLocation(ExtendedLocation extendedLocation) { + this.extendedLocation = extendedLocation; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the VirtualMachineInstanceInner object itself. + */ + public VirtualMachineInstanceInner 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (extendedLocation() != null) { + extendedLocation().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("extendedLocation", this.extendedLocation); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstanceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstanceInner 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 VirtualMachineInstanceInner. + */ + public static VirtualMachineInstanceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstanceInner deserializedVirtualMachineInstanceInner = new VirtualMachineInstanceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedVirtualMachineInstanceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedVirtualMachineInstanceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedVirtualMachineInstanceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedVirtualMachineInstanceInner.properties + = VirtualMachineInstanceProperties.fromJson(reader); + } else if ("extendedLocation".equals(fieldName)) { + deserializedVirtualMachineInstanceInner.extendedLocation = ExtendedLocation.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedVirtualMachineInstanceInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedVirtualMachineInstanceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstanceInner; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/package-info.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/package-info.java new file mode 100644 index 000000000000..2dab4fdd7431 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for AzureStackHciVm. + * Azure Stack HCI management service. + */ +package com.azure.resourcemanager.azurestackhci.vm.fluent.models; diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/package-info.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/package-info.java new file mode 100644 index 000000000000..17764c70433f --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for AzureStackHciVm. + * Azure Stack HCI management service. + */ +package com.azure.resourcemanager.azurestackhci.vm.fluent; diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AttestationStatusImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AttestationStatusImpl.java new file mode 100644 index 000000000000..7d8505df3536 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AttestationStatusImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.AttestationStatusInner; +import com.azure.resourcemanager.azurestackhci.vm.models.AttestationStatus; +import com.azure.resourcemanager.azurestackhci.vm.models.AttestationStatusProperties; + +public final class AttestationStatusImpl implements AttestationStatus { + private AttestationStatusInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + AttestationStatusImpl(AttestationStatusInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public AttestationStatusProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public AttestationStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AttestationStatusesClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AttestationStatusesClientImpl.java new file mode 100644 index 000000000000..ddf652842c96 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AttestationStatusesClientImpl.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azurestackhci.vm.fluent.AttestationStatusesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.AttestationStatusInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in AttestationStatusesClient. + */ +public final class AttestationStatusesClientImpl implements AttestationStatusesClient { + /** + * The proxy service used to perform REST calls. + */ + private final AttestationStatusesService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of AttestationStatusesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AttestationStatusesClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service = RestProxy.create(AttestationStatusesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientAttestationStatuses to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientAttestationStatuses") + public interface AttestationStatusesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/attestationStatus/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/attestationStatus/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Implements AttestationStatus GET method. + * + * @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 attestation status of the virtual machine along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(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.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements AttestationStatus GET method. + * + * @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 attestation status of the virtual machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri) { + return getWithResponseAsync(resourceUri).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Implements AttestationStatus GET method. + * + * @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 attestation status of the virtual machine along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, accept, context); + } + + /** + * Implements AttestationStatus GET method. + * + * @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 attestation status of the virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationStatusInner get(String resourceUri) { + return getWithResponse(resourceUri, Context.NONE).getValue(); + } + + private static final ClientLogger LOGGER = new ClientLogger(AttestationStatusesClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AttestationStatusesImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AttestationStatusesImpl.java new file mode 100644 index 000000000000..6b71cf06211f --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AttestationStatusesImpl.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +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.azurestackhci.vm.fluent.AttestationStatusesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.AttestationStatusInner; +import com.azure.resourcemanager.azurestackhci.vm.models.AttestationStatus; +import com.azure.resourcemanager.azurestackhci.vm.models.AttestationStatuses; + +public final class AttestationStatusesImpl implements AttestationStatuses { + private static final ClientLogger LOGGER = new ClientLogger(AttestationStatusesImpl.class); + + private final AttestationStatusesClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public AttestationStatusesImpl(AttestationStatusesClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceUri, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceUri, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AttestationStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AttestationStatus get(String resourceUri) { + AttestationStatusInner inner = this.serviceClient().get(resourceUri); + if (inner != null) { + return new AttestationStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + private AttestationStatusesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AzureStackHciVmMgmtClientBuilder.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AzureStackHciVmMgmtClientBuilder.java new file mode 100644 index 000000000000..2538b635f512 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AzureStackHciVmMgmtClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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 AzureStackHciVmMgmtClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { AzureStackHciVmMgmtClientImpl.class }) +public final class AzureStackHciVmMgmtClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the AzureStackHciVmMgmtClientBuilder. + */ + public AzureStackHciVmMgmtClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the AzureStackHciVmMgmtClientBuilder. + */ + public AzureStackHciVmMgmtClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the AzureStackHciVmMgmtClientBuilder. + */ + public AzureStackHciVmMgmtClientBuilder 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 AzureStackHciVmMgmtClientBuilder. + */ + public AzureStackHciVmMgmtClientBuilder 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 AzureStackHciVmMgmtClientBuilder. + */ + public AzureStackHciVmMgmtClientBuilder 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 AzureStackHciVmMgmtClientBuilder. + */ + public AzureStackHciVmMgmtClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AzureStackHciVmMgmtClientImpl with the provided parameters. + * + * @return an instance of AzureStackHciVmMgmtClientImpl. + */ + public AzureStackHciVmMgmtClientImpl 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(); + AzureStackHciVmMgmtClientImpl client = new AzureStackHciVmMgmtClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AzureStackHciVmMgmtClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AzureStackHciVmMgmtClientImpl.java new file mode 100644 index 000000000000..4b338bbf5c5a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/AzureStackHciVmMgmtClientImpl.java @@ -0,0 +1,484 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.azurestackhci.vm.fluent.AttestationStatusesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.AzureStackHciVmMgmtClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.HybridIdentityMetadatasClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient; +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 AzureStackHciVmMgmtClientImpl type. + */ +@ServiceClient(builder = AzureStackHciVmMgmtClientBuilder.class) +public final class AzureStackHciVmMgmtClientImpl implements AzureStackHciVmMgmtClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The GalleryImagesClient object to access its operations. + */ + private final GalleryImagesClient galleryImages; + + /** + * Gets the GalleryImagesClient object to access its operations. + * + * @return the GalleryImagesClient object. + */ + public GalleryImagesClient getGalleryImages() { + return this.galleryImages; + } + + /** + * The LogicalNetworksClient object to access its operations. + */ + private final LogicalNetworksClient logicalNetworks; + + /** + * Gets the LogicalNetworksClient object to access its operations. + * + * @return the LogicalNetworksClient object. + */ + public LogicalNetworksClient getLogicalNetworks() { + return this.logicalNetworks; + } + + /** + * The MarketplaceGalleryImagesClient object to access its operations. + */ + private final MarketplaceGalleryImagesClient marketplaceGalleryImages; + + /** + * Gets the MarketplaceGalleryImagesClient object to access its operations. + * + * @return the MarketplaceGalleryImagesClient object. + */ + public MarketplaceGalleryImagesClient getMarketplaceGalleryImages() { + return this.marketplaceGalleryImages; + } + + /** + * The NetworkInterfacesClient object to access its operations. + */ + private final NetworkInterfacesClient networkInterfaces; + + /** + * Gets the NetworkInterfacesClient object to access its operations. + * + * @return the NetworkInterfacesClient object. + */ + public NetworkInterfacesClient getNetworkInterfaces() { + return this.networkInterfaces; + } + + /** + * The NetworkSecurityGroupsClient object to access its operations. + */ + private final NetworkSecurityGroupsClient networkSecurityGroups; + + /** + * Gets the NetworkSecurityGroupsClient object to access its operations. + * + * @return the NetworkSecurityGroupsClient object. + */ + public NetworkSecurityGroupsClient getNetworkSecurityGroups() { + return this.networkSecurityGroups; + } + + /** + * The SecurityRulesClient object to access its operations. + */ + private final SecurityRulesClient securityRules; + + /** + * Gets the SecurityRulesClient object to access its operations. + * + * @return the SecurityRulesClient object. + */ + public SecurityRulesClient getSecurityRules() { + return this.securityRules; + } + + /** + * The StorageContainersClient object to access its operations. + */ + private final StorageContainersClient storageContainers; + + /** + * Gets the StorageContainersClient object to access its operations. + * + * @return the StorageContainersClient object. + */ + public StorageContainersClient getStorageContainers() { + return this.storageContainers; + } + + /** + * The VirtualHardDisksClient object to access its operations. + */ + private final VirtualHardDisksClient virtualHardDisks; + + /** + * Gets the VirtualHardDisksClient object to access its operations. + * + * @return the VirtualHardDisksClient object. + */ + public VirtualHardDisksClient getVirtualHardDisks() { + return this.virtualHardDisks; + } + + /** + * The VirtualMachineInstancesClient object to access its operations. + */ + private final VirtualMachineInstancesClient virtualMachineInstances; + + /** + * Gets the VirtualMachineInstancesClient object to access its operations. + * + * @return the VirtualMachineInstancesClient object. + */ + public VirtualMachineInstancesClient getVirtualMachineInstances() { + return this.virtualMachineInstances; + } + + /** + * The HybridIdentityMetadatasClient object to access its operations. + */ + private final HybridIdentityMetadatasClient hybridIdentityMetadatas; + + /** + * Gets the HybridIdentityMetadatasClient object to access its operations. + * + * @return the HybridIdentityMetadatasClient object. + */ + public HybridIdentityMetadatasClient getHybridIdentityMetadatas() { + return this.hybridIdentityMetadatas; + } + + /** + * The AttestationStatusesClient object to access its operations. + */ + private final AttestationStatusesClient attestationStatuses; + + /** + * Gets the AttestationStatusesClient object to access its operations. + * + * @return the AttestationStatusesClient object. + */ + public AttestationStatusesClient getAttestationStatuses() { + return this.attestationStatuses; + } + + /** + * The GuestAgentsClient object to access its operations. + */ + private final GuestAgentsClient guestAgents; + + /** + * Gets the GuestAgentsClient object to access its operations. + * + * @return the GuestAgentsClient object. + */ + public GuestAgentsClient getGuestAgents() { + return this.guestAgents; + } + + /** + * Initializes an instance of AzureStackHciVmMgmtClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + AzureStackHciVmMgmtClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2025-06-01-preview"; + this.galleryImages = new GalleryImagesClientImpl(this); + this.logicalNetworks = new LogicalNetworksClientImpl(this); + this.marketplaceGalleryImages = new MarketplaceGalleryImagesClientImpl(this); + this.networkInterfaces = new NetworkInterfacesClientImpl(this); + this.networkSecurityGroups = new NetworkSecurityGroupsClientImpl(this); + this.securityRules = new SecurityRulesClientImpl(this); + this.storageContainers = new StorageContainersClientImpl(this); + this.virtualHardDisks = new VirtualHardDisksClientImpl(this); + this.virtualMachineInstances = new VirtualMachineInstancesClientImpl(this); + this.hybridIdentityMetadatas = new HybridIdentityMetadatasClientImpl(this); + this.attestationStatuses = new AttestationStatusesClientImpl(this); + this.guestAgents = new GuestAgentsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureStackHciVmMgmtClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GalleryImageImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GalleryImageImpl.java new file mode 100644 index 000000000000..ad50e5842fb7 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GalleryImageImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImage; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageTagsUpdate; +import java.util.Collections; +import java.util.Map; + +public final class GalleryImageImpl implements GalleryImage, GalleryImage.Definition, GalleryImage.Update { + private GalleryImageInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager 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 GalleryImageProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public GalleryImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String galleryImageName; + + private GalleryImageTagsUpdate updateProperties; + + public GalleryImageImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public GalleryImage create() { + this.innerObject = serviceManager.serviceClient() + .getGalleryImages() + .createOrUpdate(resourceGroupName, galleryImageName, this.innerModel(), Context.NONE); + return this; + } + + public GalleryImage create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGalleryImages() + .createOrUpdate(resourceGroupName, galleryImageName, this.innerModel(), context); + return this; + } + + GalleryImageImpl(String name, com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = new GalleryImageInner(); + this.serviceManager = serviceManager; + this.galleryImageName = name; + } + + public GalleryImageImpl update() { + this.updateProperties = new GalleryImageTagsUpdate(); + return this; + } + + public GalleryImage apply() { + this.innerObject = serviceManager.serviceClient() + .getGalleryImages() + .update(resourceGroupName, galleryImageName, updateProperties, Context.NONE); + return this; + } + + public GalleryImage apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGalleryImages() + .update(resourceGroupName, galleryImageName, updateProperties, context); + return this; + } + + GalleryImageImpl(GalleryImageInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.galleryImageName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "galleryImages"); + } + + public GalleryImage refresh() { + this.innerObject = serviceManager.serviceClient() + .getGalleryImages() + .getByResourceGroupWithResponse(resourceGroupName, galleryImageName, Context.NONE) + .getValue(); + return this; + } + + public GalleryImage refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getGalleryImages() + .getByResourceGroupWithResponse(resourceGroupName, galleryImageName, context) + .getValue(); + return this; + } + + public GalleryImageImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public GalleryImageImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public GalleryImageImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public GalleryImageImpl withProperties(GalleryImageProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public GalleryImageImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GalleryImagesClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GalleryImagesClientImpl.java new file mode 100644 index 000000000000..55f22cbfcc2c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GalleryImagesClientImpl.java @@ -0,0 +1,1473 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.GalleryImageListResult; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageTagsUpdate; +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 GalleryImagesClient. + */ +public final class GalleryImagesClientImpl implements GalleryImagesClient { + /** + * The proxy service used to perform REST calls. + */ + private final GalleryImagesService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of GalleryImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GalleryImagesClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service + = RestProxy.create(GalleryImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientGalleryImages to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientGalleryImages") + public interface GalleryImagesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryImageName") String galleryImageName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryImageName") String galleryImageName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryImageName") String galleryImageName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") GalleryImageInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryImageName") String galleryImageName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") GalleryImageInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryImageName") String galleryImageName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") GalleryImageTagsUpdate properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryImageName") String galleryImageName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") GalleryImageTagsUpdate properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryImageName") String galleryImageName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages/{galleryImageName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("galleryImageName") String galleryImageName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/galleryImages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryImages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/galleryImages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAllNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 gallery image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String galleryImageName) { + 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 (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName 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, galleryImageName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 gallery image on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String galleryImageName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, galleryImageName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 gallery image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String galleryImageName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, galleryImageName, accept, context); + } + + /** + * Gets a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 gallery image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageInner getByResourceGroup(String resourceGroupName, String galleryImageName) { + return getByResourceGroupWithResponse(resourceGroupName, galleryImageName, Context.NONE).getValue(); + } + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String galleryImageName, GalleryImageInner 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 (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, galleryImageName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String galleryImageName, + GalleryImageInner resource) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, galleryImageName, contentType, accept, resource, + Context.NONE); + } + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String galleryImageName, + GalleryImageInner resource, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, galleryImageName, contentType, accept, resource, + context); + } + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 the gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryImageInner> + beginCreateOrUpdateAsync(String resourceGroupName, String galleryImageName, GalleryImageInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, galleryImageName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + GalleryImageInner.class, GalleryImageInner.class, this.client.getContext()); + } + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 the gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageInner> beginCreateOrUpdate(String resourceGroupName, + String galleryImageName, GalleryImageInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, galleryImageName, resource); + return this.client.getLroResult(response, GalleryImageInner.class, + GalleryImageInner.class, Context.NONE); + } + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 the gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageInner> beginCreateOrUpdate(String resourceGroupName, + String galleryImageName, GalleryImageInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, galleryImageName, resource, context); + return this.client.getLroResult(response, GalleryImageInner.class, + GalleryImageInner.class, context); + } + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String galleryImageName, + GalleryImageInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, galleryImageName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageInner createOrUpdate(String resourceGroupName, String galleryImageName, + GalleryImageInner resource) { + return beginCreateOrUpdate(resourceGroupName, galleryImageName, resource).getFinalResult(); + } + + /** + * The operation to create or update a gallery image. Please note some properties can be set only during gallery + * image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageInner createOrUpdate(String resourceGroupName, String galleryImageName, + GalleryImageInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, galleryImageName, resource, context).getFinalResult(); + } + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String galleryImageName, + GalleryImageTagsUpdate 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 (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, galleryImageName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String galleryImageName, + GalleryImageTagsUpdate properties) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, galleryImageName, contentType, accept, properties, + Context.NONE); + } + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String galleryImageName, + GalleryImageTagsUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, galleryImageName, contentType, accept, properties, + context); + } + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 the gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GalleryImageInner> beginUpdateAsync(String resourceGroupName, + String galleryImageName, GalleryImageTagsUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, galleryImageName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + GalleryImageInner.class, GalleryImageInner.class, this.client.getContext()); + } + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 the gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageInner> beginUpdate(String resourceGroupName, + String galleryImageName, GalleryImageTagsUpdate properties) { + Response response = updateWithResponse(resourceGroupName, galleryImageName, properties); + return this.client.getLroResult(response, GalleryImageInner.class, + GalleryImageInner.class, Context.NONE); + } + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 the gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GalleryImageInner> beginUpdate(String resourceGroupName, + String galleryImageName, GalleryImageTagsUpdate properties, Context context) { + Response response = updateWithResponse(resourceGroupName, galleryImageName, properties, context); + return this.client.getLroResult(response, GalleryImageInner.class, + GalleryImageInner.class, context); + } + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String galleryImageName, + GalleryImageTagsUpdate properties) { + return beginUpdateAsync(resourceGroupName, galleryImageName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageInner update(String resourceGroupName, String galleryImageName, + GalleryImageTagsUpdate properties) { + return beginUpdate(resourceGroupName, galleryImageName, properties).getFinalResult(); + } + + /** + * The operation to update a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @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 gallery images resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GalleryImageInner update(String resourceGroupName, String galleryImageName, + GalleryImageTagsUpdate properties, Context context) { + return beginUpdate(resourceGroupName, galleryImageName, properties, context).getFinalResult(); + } + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 galleryImageName) { + 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 (galleryImageName == null) { + return Mono + .error(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, galleryImageName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String galleryImageName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, galleryImageName, Context.NONE); + } + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String galleryImageName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (galleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter galleryImageName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, galleryImageName, context); + } + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 galleryImageName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, galleryImageName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 galleryImageName) { + Response response = deleteWithResponse(resourceGroupName, galleryImageName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 galleryImageName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, galleryImageName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 galleryImageName) { + return beginDeleteAsync(resourceGroupName, galleryImageName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 galleryImageName) { + beginDelete(resourceGroupName, galleryImageName).getFinalResult(); + } + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 galleryImageName, Context context) { + beginDelete(resourceGroupName, galleryImageName, context).getFinalResult(); + } + + /** + * Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @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 GalleryImage 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())); + } + + /** + * Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @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 GalleryImage 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)); + } + + /** + * Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @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 GalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @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 GalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @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 GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @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 GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage 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())); + } + + /** + * Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listAllNextSinglePage(nextLink)); + } + + /** + * Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listAllNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(GalleryImagesClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GalleryImagesImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GalleryImagesImpl.java new file mode 100644 index 000000000000..7154a01aa870 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GalleryImagesImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.GalleryImagesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GalleryImageInner; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImage; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImages; + +public final class GalleryImagesImpl implements GalleryImages { + private static final ClientLogger LOGGER = new ClientLogger(GalleryImagesImpl.class); + + private final GalleryImagesClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public GalleryImagesImpl(GalleryImagesClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String galleryImageName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, galleryImageName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GalleryImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GalleryImage getByResourceGroup(String resourceGroupName, String galleryImageName) { + GalleryImageInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, galleryImageName); + if (inner != null) { + return new GalleryImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String galleryImageName) { + this.serviceClient().delete(resourceGroupName, galleryImageName); + } + + public void delete(String resourceGroupName, String galleryImageName, Context context) { + this.serviceClient().delete(resourceGroupName, galleryImageName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GalleryImageImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GalleryImageImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GalleryImageImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GalleryImageImpl(inner1, this.manager())); + } + + public GalleryImage 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 galleryImageName = ResourceManagerUtils.getValueFromIdByName(id, "galleryImages"); + if (galleryImageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleryImages'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, galleryImageName, 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 galleryImageName = ResourceManagerUtils.getValueFromIdByName(id, "galleryImages"); + if (galleryImageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleryImages'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, galleryImageName, 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 galleryImageName = ResourceManagerUtils.getValueFromIdByName(id, "galleryImages"); + if (galleryImageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleryImages'.", id))); + } + this.delete(resourceGroupName, galleryImageName, 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 galleryImageName = ResourceManagerUtils.getValueFromIdByName(id, "galleryImages"); + if (galleryImageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'galleryImages'.", id))); + } + this.delete(resourceGroupName, galleryImageName, context); + } + + private GalleryImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + public GalleryImageImpl define(String name) { + return new GalleryImageImpl(name, this.manager()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GuestAgentImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GuestAgentImpl.java new file mode 100644 index 000000000000..9cb29c4b511c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GuestAgentImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GuestAgentInner; +import com.azure.resourcemanager.azurestackhci.vm.models.GuestAgent; +import com.azure.resourcemanager.azurestackhci.vm.models.GuestAgentProperties; + +public final class GuestAgentImpl implements GuestAgent { + private GuestAgentInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + GuestAgentImpl(GuestAgentInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public GuestAgentProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public GuestAgentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GuestAgentsClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GuestAgentsClientImpl.java new file mode 100644 index 000000000000..b8bbee5a937a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GuestAgentsClientImpl.java @@ -0,0 +1,812 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GuestAgentInner; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.GuestAgentListResult; +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 GuestAgentsClient. + */ +public final class GuestAgentsClientImpl implements GuestAgentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final GuestAgentsService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of GuestAgentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + GuestAgentsClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service + = RestProxy.create(GuestAgentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientGuestAgents to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientGuestAgents") + public interface GuestAgentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") GuestAgentInner resource, Context context); + + @Put("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") GuestAgentInner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents/default") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVirtualMachineInstance(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/guestAgents") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByVirtualMachineInstanceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVirtualMachineInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByVirtualMachineInstanceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Implements GuestAgent GET method. + * + * @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 defines the GuestAgent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(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.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements GuestAgent GET method. + * + * @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 defines the GuestAgent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri) { + return getWithResponseAsync(resourceUri).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Implements GuestAgent GET method. + * + * @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 defines the GuestAgent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, accept, context); + } + + /** + * Implements GuestAgent GET method. + * + * @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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GuestAgentInner get(String resourceUri) { + return getWithResponse(resourceUri, Context.NONE).getValue(); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceUri, GuestAgentInner 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 (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceUri, GuestAgentInner resource) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, contentType, + accept, resource, Context.NONE); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceUri, GuestAgentInner resource, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, contentType, + accept, resource, context); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, GuestAgentInner> beginCreateAsync(String resourceUri, + GuestAgentInner resource) { + Mono>> mono = createWithResponseAsync(resourceUri, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + GuestAgentInner.class, GuestAgentInner.class, this.client.getContext()); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GuestAgentInner> beginCreate(String resourceUri, + GuestAgentInner resource) { + Response response = createWithResponse(resourceUri, resource); + return this.client.getLroResult(response, GuestAgentInner.class, + GuestAgentInner.class, Context.NONE); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, GuestAgentInner> beginCreate(String resourceUri, + GuestAgentInner resource, Context context) { + Response response = createWithResponse(resourceUri, resource, context); + return this.client.getLroResult(response, GuestAgentInner.class, + GuestAgentInner.class, context); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceUri, GuestAgentInner resource) { + return beginCreateAsync(resourceUri, resource).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GuestAgentInner create(String resourceUri, GuestAgentInner resource) { + return beginCreate(resourceUri, resource).getFinalResult(); + } + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public GuestAgentInner create(String resourceUri, GuestAgentInner resource, Context context) { + return beginCreate(resourceUri, resource, context).getFinalResult(); + } + + /** + * Implements GuestAgent DELETE method. + * + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(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.")); + } + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements GuestAgent DELETE method. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, Context.NONE); + } + + /** + * Implements GuestAgent DELETE method. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context); + } + + /** + * Implements GuestAgent DELETE method. + * + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceUri) { + Mono>> mono = deleteWithResponseAsync(resourceUri); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Implements GuestAgent DELETE method. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri) { + Response response = deleteWithResponse(resourceUri); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Implements GuestAgent DELETE method. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri, Context context) { + Response response = deleteWithResponse(resourceUri, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Implements GuestAgent DELETE method. + * + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceUri) { + return beginDeleteAsync(resourceUri).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Implements GuestAgent DELETE method. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri) { + beginDelete(resourceUri).getFinalResult(); + } + + /** + * Implements GuestAgent DELETE method. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, Context context) { + beginDelete(resourceUri, context).getFinalResult(); + } + + /** + * Returns the list of GuestAgent of the given vm. + * + * @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 GuestAgent list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVirtualMachineInstanceSinglePageAsync(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.listByVirtualMachineInstance(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())); + } + + /** + * Returns the list of GuestAgent of the given vm. + * + * @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 GuestAgent list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVirtualMachineInstanceAsync(String resourceUri) { + return new PagedFlux<>(() -> listByVirtualMachineInstanceSinglePageAsync(resourceUri), + nextLink -> listByVirtualMachineInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Returns the list of GuestAgent of the given vm. + * + * @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 GuestAgent list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByVirtualMachineInstanceSinglePage(String resourceUri) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByVirtualMachineInstanceSync(this.client.getEndpoint(), + this.client.getApiVersion(), resourceUri, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Returns the list of GuestAgent of the given vm. + * + * @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 GuestAgent list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByVirtualMachineInstanceSinglePage(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByVirtualMachineInstanceSync(this.client.getEndpoint(), + this.client.getApiVersion(), resourceUri, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Returns the list of GuestAgent of the given vm. + * + * @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 GuestAgent list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVirtualMachineInstance(String resourceUri) { + return new PagedIterable<>(() -> listByVirtualMachineInstanceSinglePage(resourceUri), + nextLink -> listByVirtualMachineInstanceNextSinglePage(nextLink)); + } + + /** + * Returns the list of GuestAgent of the given vm. + * + * @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 GuestAgent list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVirtualMachineInstance(String resourceUri, Context context) { + return new PagedIterable<>(() -> listByVirtualMachineInstanceSinglePage(resourceUri, context), + nextLink -> listByVirtualMachineInstanceNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GuestAgent list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByVirtualMachineInstanceNextSinglePageAsync(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.listByVirtualMachineInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GuestAgent list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByVirtualMachineInstanceNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByVirtualMachineInstanceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GuestAgent list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByVirtualMachineInstanceNextSinglePage(String nextLink, + Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByVirtualMachineInstanceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(GuestAgentsClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GuestAgentsImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GuestAgentsImpl.java new file mode 100644 index 000000000000..f771ea47044c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/GuestAgentsImpl.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.GuestAgentsClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GuestAgentInner; +import com.azure.resourcemanager.azurestackhci.vm.models.GuestAgent; +import com.azure.resourcemanager.azurestackhci.vm.models.GuestAgents; + +public final class GuestAgentsImpl implements GuestAgents { + private static final ClientLogger LOGGER = new ClientLogger(GuestAgentsImpl.class); + + private final GuestAgentsClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public GuestAgentsImpl(GuestAgentsClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceUri, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceUri, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new GuestAgentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public GuestAgent get(String resourceUri) { + GuestAgentInner inner = this.serviceClient().get(resourceUri); + if (inner != null) { + return new GuestAgentImpl(inner, this.manager()); + } else { + return null; + } + } + + public GuestAgent create(String resourceUri, GuestAgentInner resource) { + GuestAgentInner inner = this.serviceClient().create(resourceUri, resource); + if (inner != null) { + return new GuestAgentImpl(inner, this.manager()); + } else { + return null; + } + } + + public GuestAgent create(String resourceUri, GuestAgentInner resource, Context context) { + GuestAgentInner inner = this.serviceClient().create(resourceUri, resource, context); + if (inner != null) { + return new GuestAgentImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceUri) { + this.serviceClient().delete(resourceUri); + } + + public void delete(String resourceUri, Context context) { + this.serviceClient().delete(resourceUri, context); + } + + public PagedIterable listByVirtualMachineInstance(String resourceUri) { + PagedIterable inner = this.serviceClient().listByVirtualMachineInstance(resourceUri); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GuestAgentImpl(inner1, this.manager())); + } + + public PagedIterable listByVirtualMachineInstance(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().listByVirtualMachineInstance(resourceUri, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new GuestAgentImpl(inner1, this.manager())); + } + + private GuestAgentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/HybridIdentityMetadataImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/HybridIdentityMetadataImpl.java new file mode 100644 index 000000000000..d4797c33facb --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/HybridIdentityMetadataImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.HybridIdentityMetadataInner; +import com.azure.resourcemanager.azurestackhci.vm.models.HybridIdentityMetadata; +import com.azure.resourcemanager.azurestackhci.vm.models.HybridIdentityMetadataProperties; + +public final class HybridIdentityMetadataImpl implements HybridIdentityMetadata { + private HybridIdentityMetadataInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + HybridIdentityMetadataImpl(HybridIdentityMetadataInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public HybridIdentityMetadataProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public HybridIdentityMetadataInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/HybridIdentityMetadatasClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/HybridIdentityMetadatasClientImpl.java new file mode 100644 index 000000000000..45ede8b580bf --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/HybridIdentityMetadatasClientImpl.java @@ -0,0 +1,414 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.azurestackhci.vm.fluent.HybridIdentityMetadatasClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.HybridIdentityMetadataInner; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.HybridIdentityMetadataListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in HybridIdentityMetadatasClient. + */ +public final class HybridIdentityMetadatasClientImpl implements HybridIdentityMetadatasClient { + /** + * The proxy service used to perform REST calls. + */ + private final HybridIdentityMetadatasService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of HybridIdentityMetadatasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HybridIdentityMetadatasClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service = RestProxy.create(HybridIdentityMetadatasService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientHybridIdentityMetadatas to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientHybridIdentityMetadatas") + public interface HybridIdentityMetadatasService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVirtualMachineInstance( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/hybridIdentityMetadata") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByVirtualMachineInstanceSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByVirtualMachineInstanceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByVirtualMachineInstanceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Implements HybridIdentityMetadata GET method. + * + * @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 defines the HybridIdentityMetadata along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(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.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Implements HybridIdentityMetadata GET method. + * + * @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 defines the HybridIdentityMetadata on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri) { + return getWithResponseAsync(resourceUri).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Implements HybridIdentityMetadata GET method. + * + * @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 defines the HybridIdentityMetadata along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, accept, context); + } + + /** + * Implements HybridIdentityMetadata GET method. + * + * @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 defines the HybridIdentityMetadata. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HybridIdentityMetadataInner get(String resourceUri) { + return getWithResponse(resourceUri, Context.NONE).getValue(); + } + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @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 HybridIdentityMetadata list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByVirtualMachineInstanceSinglePageAsync(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.listByVirtualMachineInstance(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())); + } + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @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 HybridIdentityMetadata list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByVirtualMachineInstanceAsync(String resourceUri) { + return new PagedFlux<>(() -> listByVirtualMachineInstanceSinglePageAsync(resourceUri), + nextLink -> listByVirtualMachineInstanceNextSinglePageAsync(nextLink)); + } + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @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 HybridIdentityMetadata list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByVirtualMachineInstanceSinglePage(String resourceUri) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByVirtualMachineInstanceSync( + this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @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 HybridIdentityMetadata list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByVirtualMachineInstanceSinglePage(String resourceUri, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByVirtualMachineInstanceSync( + this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @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 HybridIdentityMetadata list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVirtualMachineInstance(String resourceUri) { + return new PagedIterable<>(() -> listByVirtualMachineInstanceSinglePage(resourceUri), + nextLink -> listByVirtualMachineInstanceNextSinglePage(nextLink)); + } + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @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 HybridIdentityMetadata list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByVirtualMachineInstance(String resourceUri, + Context context) { + return new PagedIterable<>(() -> listByVirtualMachineInstanceSinglePage(resourceUri, context), + nextLink -> listByVirtualMachineInstanceNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a HybridIdentityMetadata list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByVirtualMachineInstanceNextSinglePageAsync(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.listByVirtualMachineInstanceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a HybridIdentityMetadata list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByVirtualMachineInstanceNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByVirtualMachineInstanceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a HybridIdentityMetadata list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByVirtualMachineInstanceNextSinglePage(String nextLink, + Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByVirtualMachineInstanceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(HybridIdentityMetadatasClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/HybridIdentityMetadatasImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/HybridIdentityMetadatasImpl.java new file mode 100644 index 000000000000..bffd3967b1c4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/HybridIdentityMetadatasImpl.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.HybridIdentityMetadatasClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.HybridIdentityMetadataInner; +import com.azure.resourcemanager.azurestackhci.vm.models.HybridIdentityMetadata; +import com.azure.resourcemanager.azurestackhci.vm.models.HybridIdentityMetadatas; + +public final class HybridIdentityMetadatasImpl implements HybridIdentityMetadatas { + private static final ClientLogger LOGGER = new ClientLogger(HybridIdentityMetadatasImpl.class); + + private final HybridIdentityMetadatasClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public HybridIdentityMetadatasImpl(HybridIdentityMetadatasClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceUri, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceUri, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new HybridIdentityMetadataImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public HybridIdentityMetadata get(String resourceUri) { + HybridIdentityMetadataInner inner = this.serviceClient().get(resourceUri); + if (inner != null) { + return new HybridIdentityMetadataImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByVirtualMachineInstance(String resourceUri) { + PagedIterable inner + = this.serviceClient().listByVirtualMachineInstance(resourceUri); + return ResourceManagerUtils.mapPage(inner, inner1 -> new HybridIdentityMetadataImpl(inner1, this.manager())); + } + + public PagedIterable listByVirtualMachineInstance(String resourceUri, Context context) { + PagedIterable inner + = this.serviceClient().listByVirtualMachineInstance(resourceUri, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new HybridIdentityMetadataImpl(inner1, this.manager())); + } + + private HybridIdentityMetadatasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/LogicalNetworkImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/LogicalNetworkImpl.java new file mode 100644 index 000000000000..716ba6584d62 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/LogicalNetworkImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.LogicalNetworkInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetwork; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworksUpdateRequest; +import java.util.Collections; +import java.util.Map; + +public final class LogicalNetworkImpl implements LogicalNetwork, LogicalNetwork.Definition, LogicalNetwork.Update { + private LogicalNetworkInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager 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 LogicalNetworkProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public LogicalNetworkInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String logicalNetworkName; + + private LogicalNetworksUpdateRequest updateProperties; + + public LogicalNetworkImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public LogicalNetwork create() { + this.innerObject = serviceManager.serviceClient() + .getLogicalNetworks() + .createOrUpdate(resourceGroupName, logicalNetworkName, this.innerModel(), Context.NONE); + return this; + } + + public LogicalNetwork create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLogicalNetworks() + .createOrUpdate(resourceGroupName, logicalNetworkName, this.innerModel(), context); + return this; + } + + LogicalNetworkImpl(String name, com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = new LogicalNetworkInner(); + this.serviceManager = serviceManager; + this.logicalNetworkName = name; + } + + public LogicalNetworkImpl update() { + this.updateProperties = new LogicalNetworksUpdateRequest(); + return this; + } + + public LogicalNetwork apply() { + this.innerObject = serviceManager.serviceClient() + .getLogicalNetworks() + .update(resourceGroupName, logicalNetworkName, updateProperties, Context.NONE); + return this; + } + + public LogicalNetwork apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLogicalNetworks() + .update(resourceGroupName, logicalNetworkName, updateProperties, context); + return this; + } + + LogicalNetworkImpl(LogicalNetworkInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.logicalNetworkName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "logicalNetworks"); + } + + public LogicalNetwork refresh() { + this.innerObject = serviceManager.serviceClient() + .getLogicalNetworks() + .getByResourceGroupWithResponse(resourceGroupName, logicalNetworkName, Context.NONE) + .getValue(); + return this; + } + + public LogicalNetwork refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLogicalNetworks() + .getByResourceGroupWithResponse(resourceGroupName, logicalNetworkName, context) + .getValue(); + return this; + } + + public LogicalNetworkImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public LogicalNetworkImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public LogicalNetworkImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public LogicalNetworkImpl withProperties(LogicalNetworkProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public LogicalNetworkImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/LogicalNetworksClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/LogicalNetworksClientImpl.java new file mode 100644 index 000000000000..d7627f54a4ba --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/LogicalNetworksClientImpl.java @@ -0,0 +1,1476 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.LogicalNetworkInner; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.LogicalNetworkListResult; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworksUpdateRequest; +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 LogicalNetworksClient. + */ +public final class LogicalNetworksClientImpl implements LogicalNetworksClient { + /** + * The proxy service used to perform REST calls. + */ + private final LogicalNetworksService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of LogicalNetworksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LogicalNetworksClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service + = RestProxy.create(LogicalNetworksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientLogicalNetworks to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientLogicalNetworks") + public interface LogicalNetworksService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("logicalNetworkName") String logicalNetworkName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("logicalNetworkName") String logicalNetworkName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("logicalNetworkName") String logicalNetworkName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") LogicalNetworkInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("logicalNetworkName") String logicalNetworkName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") LogicalNetworkInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("logicalNetworkName") String logicalNetworkName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") LogicalNetworksUpdateRequest properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("logicalNetworkName") String logicalNetworkName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") LogicalNetworksUpdateRequest properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("logicalNetworkName") String logicalNetworkName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks/{logicalNetworkName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("logicalNetworkName") String logicalNetworkName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/logicalNetworks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/logicalNetworks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/logicalNetworks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAllNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * The operation to get a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logical network resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String logicalNetworkName) { + 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 (logicalNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter logicalNetworkName 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, logicalNetworkName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to get a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logical network resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String logicalNetworkName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, logicalNetworkName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * The operation to get a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logical network resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String logicalNetworkName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (logicalNetworkName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter logicalNetworkName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, logicalNetworkName, accept, context); + } + + /** + * The operation to get a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogicalNetworkInner getByResourceGroup(String resourceGroupName, String logicalNetworkName) { + return getByResourceGroupWithResponse(resourceGroupName, logicalNetworkName, Context.NONE).getValue(); + } + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String logicalNetworkName, LogicalNetworkInner 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 (logicalNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter logicalNetworkName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, logicalNetworkName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String logicalNetworkName, + LogicalNetworkInner resource) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (logicalNetworkName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter logicalNetworkName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, logicalNetworkName, contentType, accept, resource, + Context.NONE); + } + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String logicalNetworkName, + LogicalNetworkInner resource, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (logicalNetworkName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter logicalNetworkName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, logicalNetworkName, contentType, accept, resource, + context); + } + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LogicalNetworkInner> + beginCreateOrUpdateAsync(String resourceGroupName, String logicalNetworkName, LogicalNetworkInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, logicalNetworkName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + LogicalNetworkInner.class, LogicalNetworkInner.class, this.client.getContext()); + } + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LogicalNetworkInner> + beginCreateOrUpdate(String resourceGroupName, String logicalNetworkName, LogicalNetworkInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, logicalNetworkName, resource); + return this.client.getLroResult(response, LogicalNetworkInner.class, + LogicalNetworkInner.class, Context.NONE); + } + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LogicalNetworkInner> beginCreateOrUpdate( + String resourceGroupName, String logicalNetworkName, LogicalNetworkInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, logicalNetworkName, resource, context); + return this.client.getLroResult(response, LogicalNetworkInner.class, + LogicalNetworkInner.class, context); + } + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String logicalNetworkName, + LogicalNetworkInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, logicalNetworkName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogicalNetworkInner createOrUpdate(String resourceGroupName, String logicalNetworkName, + LogicalNetworkInner resource) { + return beginCreateOrUpdate(resourceGroupName, logicalNetworkName, resource).getFinalResult(); + } + + /** + * The operation to create or update a logical network. Please note some properties can be set only during logical + * network creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogicalNetworkInner createOrUpdate(String resourceGroupName, String logicalNetworkName, + LogicalNetworkInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, logicalNetworkName, resource, context).getFinalResult(); + } + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String logicalNetworkName, LogicalNetworksUpdateRequest 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 (logicalNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter logicalNetworkName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, logicalNetworkName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String logicalNetworkName, + LogicalNetworksUpdateRequest properties) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (logicalNetworkName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter logicalNetworkName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, logicalNetworkName, contentType, accept, properties, + Context.NONE); + } + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String logicalNetworkName, + LogicalNetworksUpdateRequest properties, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (logicalNetworkName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter logicalNetworkName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, logicalNetworkName, contentType, accept, properties, + context); + } + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LogicalNetworkInner> beginUpdateAsync(String resourceGroupName, + String logicalNetworkName, LogicalNetworksUpdateRequest properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, logicalNetworkName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + LogicalNetworkInner.class, LogicalNetworkInner.class, this.client.getContext()); + } + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LogicalNetworkInner> beginUpdate(String resourceGroupName, + String logicalNetworkName, LogicalNetworksUpdateRequest properties) { + Response response = updateWithResponse(resourceGroupName, logicalNetworkName, properties); + return this.client.getLroResult(response, LogicalNetworkInner.class, + LogicalNetworkInner.class, Context.NONE); + } + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 the logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LogicalNetworkInner> beginUpdate(String resourceGroupName, + String logicalNetworkName, LogicalNetworksUpdateRequest properties, Context context) { + Response response = updateWithResponse(resourceGroupName, logicalNetworkName, properties, context); + return this.client.getLroResult(response, LogicalNetworkInner.class, + LogicalNetworkInner.class, context); + } + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String logicalNetworkName, + LogicalNetworksUpdateRequest properties) { + return beginUpdateAsync(resourceGroupName, logicalNetworkName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogicalNetworkInner update(String resourceGroupName, String logicalNetworkName, + LogicalNetworksUpdateRequest properties) { + return beginUpdate(resourceGroupName, logicalNetworkName, properties).getFinalResult(); + } + + /** + * The operation to update a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @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 logical network resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogicalNetworkInner update(String resourceGroupName, String logicalNetworkName, + LogicalNetworksUpdateRequest properties, Context context) { + return beginUpdate(resourceGroupName, logicalNetworkName, properties, context).getFinalResult(); + } + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 logicalNetworkName) { + 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 (logicalNetworkName == null) { + return Mono + .error(new IllegalArgumentException("Parameter logicalNetworkName is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, logicalNetworkName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String logicalNetworkName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (logicalNetworkName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter logicalNetworkName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, logicalNetworkName, Context.NONE); + } + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String logicalNetworkName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (logicalNetworkName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter logicalNetworkName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, logicalNetworkName, context); + } + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 logicalNetworkName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, logicalNetworkName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 logicalNetworkName) { + Response response = deleteWithResponse(resourceGroupName, logicalNetworkName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 logicalNetworkName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, logicalNetworkName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 logicalNetworkName) { + return beginDeleteAsync(resourceGroupName, logicalNetworkName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 logicalNetworkName) { + beginDelete(resourceGroupName, logicalNetworkName).getFinalResult(); + } + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 logicalNetworkName, Context context) { + beginDelete(resourceGroupName, logicalNetworkName, context).getFinalResult(); + } + + /** + * Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to + * get the next page of logical networks. + * + * @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 LogicalNetwork 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())); + } + + /** + * Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to + * get the next page of logical networks. + * + * @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 LogicalNetwork 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)); + } + + /** + * Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to + * get the next page of logical networks. + * + * @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 LogicalNetwork list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to + * get the next page of logical networks. + * + * @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 LogicalNetwork list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to + * get the next page of logical networks. + * + * @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 LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to + * get the next page of logical networks. + * + * @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 LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get + * the next page of logical networks. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork 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())); + } + + /** + * Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get + * the next page of logical networks. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get + * the next page of logical networks. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get + * the next page of logical networks. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get + * the next page of logical networks. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listAllNextSinglePage(nextLink)); + } + + /** + * Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get + * the next page of logical networks. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listAllNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(LogicalNetworksClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/LogicalNetworksImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/LogicalNetworksImpl.java new file mode 100644 index 000000000000..83724f640b7d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/LogicalNetworksImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.LogicalNetworksClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.LogicalNetworkInner; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetwork; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworks; + +public final class LogicalNetworksImpl implements LogicalNetworks { + private static final ClientLogger LOGGER = new ClientLogger(LogicalNetworksImpl.class); + + private final LogicalNetworksClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public LogicalNetworksImpl(LogicalNetworksClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String logicalNetworkName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, logicalNetworkName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new LogicalNetworkImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LogicalNetwork getByResourceGroup(String resourceGroupName, String logicalNetworkName) { + LogicalNetworkInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, logicalNetworkName); + if (inner != null) { + return new LogicalNetworkImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String logicalNetworkName) { + this.serviceClient().delete(resourceGroupName, logicalNetworkName); + } + + public void delete(String resourceGroupName, String logicalNetworkName, Context context) { + this.serviceClient().delete(resourceGroupName, logicalNetworkName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LogicalNetworkImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LogicalNetworkImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LogicalNetworkImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LogicalNetworkImpl(inner1, this.manager())); + } + + public LogicalNetwork 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 logicalNetworkName = ResourceManagerUtils.getValueFromIdByName(id, "logicalNetworks"); + if (logicalNetworkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'logicalNetworks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, logicalNetworkName, 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 logicalNetworkName = ResourceManagerUtils.getValueFromIdByName(id, "logicalNetworks"); + if (logicalNetworkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'logicalNetworks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, logicalNetworkName, 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 logicalNetworkName = ResourceManagerUtils.getValueFromIdByName(id, "logicalNetworks"); + if (logicalNetworkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'logicalNetworks'.", id))); + } + this.delete(resourceGroupName, logicalNetworkName, 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 logicalNetworkName = ResourceManagerUtils.getValueFromIdByName(id, "logicalNetworks"); + if (logicalNetworkName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'logicalNetworks'.", id))); + } + this.delete(resourceGroupName, logicalNetworkName, context); + } + + private LogicalNetworksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + public LogicalNetworkImpl define(String name) { + return new LogicalNetworkImpl(name, this.manager()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/MarketplaceGalleryImageImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/MarketplaceGalleryImageImpl.java new file mode 100644 index 000000000000..b883251879ac --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/MarketplaceGalleryImageImpl.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.MarketplaceGalleryImageInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImage; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageTagsUpdate; +import java.util.Collections; +import java.util.Map; + +public final class MarketplaceGalleryImageImpl + implements MarketplaceGalleryImage, MarketplaceGalleryImage.Definition, MarketplaceGalleryImage.Update { + private MarketplaceGalleryImageInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager 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 MarketplaceGalleryImageProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MarketplaceGalleryImageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String marketplaceGalleryImageName; + + private MarketplaceGalleryImageTagsUpdate updateProperties; + + public MarketplaceGalleryImageImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public MarketplaceGalleryImage create() { + this.innerObject = serviceManager.serviceClient() + .getMarketplaceGalleryImages() + .createOrUpdate(resourceGroupName, marketplaceGalleryImageName, this.innerModel(), Context.NONE); + return this; + } + + public MarketplaceGalleryImage create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMarketplaceGalleryImages() + .createOrUpdate(resourceGroupName, marketplaceGalleryImageName, this.innerModel(), context); + return this; + } + + MarketplaceGalleryImageImpl(String name, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = new MarketplaceGalleryImageInner(); + this.serviceManager = serviceManager; + this.marketplaceGalleryImageName = name; + } + + public MarketplaceGalleryImageImpl update() { + this.updateProperties = new MarketplaceGalleryImageTagsUpdate(); + return this; + } + + public MarketplaceGalleryImage apply() { + this.innerObject = serviceManager.serviceClient() + .getMarketplaceGalleryImages() + .update(resourceGroupName, marketplaceGalleryImageName, updateProperties, Context.NONE); + return this; + } + + public MarketplaceGalleryImage apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMarketplaceGalleryImages() + .update(resourceGroupName, marketplaceGalleryImageName, updateProperties, context); + return this; + } + + MarketplaceGalleryImageImpl(MarketplaceGalleryImageInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.marketplaceGalleryImageName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "marketplaceGalleryImages"); + } + + public MarketplaceGalleryImage refresh() { + this.innerObject = serviceManager.serviceClient() + .getMarketplaceGalleryImages() + .getByResourceGroupWithResponse(resourceGroupName, marketplaceGalleryImageName, Context.NONE) + .getValue(); + return this; + } + + public MarketplaceGalleryImage refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMarketplaceGalleryImages() + .getByResourceGroupWithResponse(resourceGroupName, marketplaceGalleryImageName, context) + .getValue(); + return this; + } + + public MarketplaceGalleryImageImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public MarketplaceGalleryImageImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public MarketplaceGalleryImageImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public MarketplaceGalleryImageImpl withProperties(MarketplaceGalleryImageProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public MarketplaceGalleryImageImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/MarketplaceGalleryImagesClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/MarketplaceGalleryImagesClientImpl.java new file mode 100644 index 000000000000..ed79e7f9fde7 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/MarketplaceGalleryImagesClientImpl.java @@ -0,0 +1,1498 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.MarketplaceGalleryImageInner; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.MarketplaceGalleryImageListResult; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageTagsUpdate; +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 MarketplaceGalleryImagesClient. + */ +public final class MarketplaceGalleryImagesClientImpl implements MarketplaceGalleryImagesClient { + /** + * The proxy service used to perform REST calls. + */ + private final MarketplaceGalleryImagesService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of MarketplaceGalleryImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MarketplaceGalleryImagesClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service = RestProxy.create(MarketplaceGalleryImagesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientMarketplaceGalleryImages to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientMarketplaceGalleryImages") + public interface MarketplaceGalleryImagesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("marketplaceGalleryImageName") String marketplaceGalleryImageName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("marketplaceGalleryImageName") String marketplaceGalleryImageName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("marketplaceGalleryImageName") String marketplaceGalleryImageName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") MarketplaceGalleryImageInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("marketplaceGalleryImageName") String marketplaceGalleryImageName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") MarketplaceGalleryImageInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("marketplaceGalleryImageName") String marketplaceGalleryImageName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") MarketplaceGalleryImageTagsUpdate properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("marketplaceGalleryImageName") String marketplaceGalleryImageName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") MarketplaceGalleryImageTagsUpdate properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("marketplaceGalleryImageName") String marketplaceGalleryImageName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/{marketplaceGalleryImageName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("marketplaceGalleryImageName") String marketplaceGalleryImageName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAllNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 marketplace gallery image along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String marketplaceGalleryImageName) { + 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 (marketplaceGalleryImageName == null) { + return Mono.error( + new IllegalArgumentException("Parameter marketplaceGalleryImageName 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, marketplaceGalleryImageName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 marketplace gallery image on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String marketplaceGalleryImageName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, marketplaceGalleryImageName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 marketplace gallery image along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String marketplaceGalleryImageName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (marketplaceGalleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter marketplaceGalleryImageName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, marketplaceGalleryImageName, accept, context); + } + + /** + * Gets a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 marketplace gallery image. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MarketplaceGalleryImageInner getByResourceGroup(String resourceGroupName, + String marketplaceGalleryImageName) { + return getByResourceGroupWithResponse(resourceGroupName, marketplaceGalleryImageName, Context.NONE).getValue(); + } + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String marketplaceGalleryImageName, MarketplaceGalleryImageInner 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 (marketplaceGalleryImageName == null) { + return Mono.error( + new IllegalArgumentException("Parameter marketplaceGalleryImageName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, marketplaceGalleryImageName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, + String marketplaceGalleryImageName, MarketplaceGalleryImageInner resource) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (marketplaceGalleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter marketplaceGalleryImageName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, marketplaceGalleryImageName, contentType, accept, + resource, Context.NONE); + } + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, + String marketplaceGalleryImageName, MarketplaceGalleryImageInner resource, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (marketplaceGalleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter marketplaceGalleryImageName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, marketplaceGalleryImageName, contentType, accept, + resource, context); + } + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 the marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MarketplaceGalleryImageInner> beginCreateOrUpdateAsync( + String resourceGroupName, String marketplaceGalleryImageName, MarketplaceGalleryImageInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, marketplaceGalleryImageName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), MarketplaceGalleryImageInner.class, MarketplaceGalleryImageInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 the marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MarketplaceGalleryImageInner> beginCreateOrUpdate( + String resourceGroupName, String marketplaceGalleryImageName, MarketplaceGalleryImageInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, marketplaceGalleryImageName, resource); + return this.client.getLroResult(response, + MarketplaceGalleryImageInner.class, MarketplaceGalleryImageInner.class, Context.NONE); + } + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 the marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MarketplaceGalleryImageInner> beginCreateOrUpdate( + String resourceGroupName, String marketplaceGalleryImageName, MarketplaceGalleryImageInner resource, + Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, marketplaceGalleryImageName, resource, context); + return this.client.getLroResult(response, + MarketplaceGalleryImageInner.class, MarketplaceGalleryImageInner.class, context); + } + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String marketplaceGalleryImageName, MarketplaceGalleryImageInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, marketplaceGalleryImageName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MarketplaceGalleryImageInner createOrUpdate(String resourceGroupName, String marketplaceGalleryImageName, + MarketplaceGalleryImageInner resource) { + return beginCreateOrUpdate(resourceGroupName, marketplaceGalleryImageName, resource).getFinalResult(); + } + + /** + * The operation to create or update a marketplace gallery image. Please note some properties can be set only during + * marketplace gallery image creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MarketplaceGalleryImageInner createOrUpdate(String resourceGroupName, String marketplaceGalleryImageName, + MarketplaceGalleryImageInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, marketplaceGalleryImageName, resource, context).getFinalResult(); + } + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String marketplaceGalleryImageName, MarketplaceGalleryImageTagsUpdate 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 (marketplaceGalleryImageName == null) { + return Mono.error( + new IllegalArgumentException("Parameter marketplaceGalleryImageName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, marketplaceGalleryImageName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String marketplaceGalleryImageName, + MarketplaceGalleryImageTagsUpdate properties) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (marketplaceGalleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter marketplaceGalleryImageName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, marketplaceGalleryImageName, contentType, accept, + properties, Context.NONE); + } + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String marketplaceGalleryImageName, + MarketplaceGalleryImageTagsUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (marketplaceGalleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter marketplaceGalleryImageName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, marketplaceGalleryImageName, contentType, accept, + properties, context); + } + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 the marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MarketplaceGalleryImageInner> beginUpdateAsync( + String resourceGroupName, String marketplaceGalleryImageName, MarketplaceGalleryImageTagsUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, marketplaceGalleryImageName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), MarketplaceGalleryImageInner.class, MarketplaceGalleryImageInner.class, + this.client.getContext()); + } + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 the marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MarketplaceGalleryImageInner> beginUpdate( + String resourceGroupName, String marketplaceGalleryImageName, MarketplaceGalleryImageTagsUpdate properties) { + Response response = updateWithResponse(resourceGroupName, marketplaceGalleryImageName, properties); + return this.client.getLroResult(response, + MarketplaceGalleryImageInner.class, MarketplaceGalleryImageInner.class, Context.NONE); + } + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 the marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MarketplaceGalleryImageInner> beginUpdate( + String resourceGroupName, String marketplaceGalleryImageName, MarketplaceGalleryImageTagsUpdate properties, + Context context) { + Response response + = updateWithResponse(resourceGroupName, marketplaceGalleryImageName, properties, context); + return this.client.getLroResult(response, + MarketplaceGalleryImageInner.class, MarketplaceGalleryImageInner.class, context); + } + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String marketplaceGalleryImageName, + MarketplaceGalleryImageTagsUpdate properties) { + return beginUpdateAsync(resourceGroupName, marketplaceGalleryImageName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MarketplaceGalleryImageInner update(String resourceGroupName, String marketplaceGalleryImageName, + MarketplaceGalleryImageTagsUpdate properties) { + return beginUpdate(resourceGroupName, marketplaceGalleryImageName, properties).getFinalResult(); + } + + /** + * The operation to update a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @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 marketplace gallery image resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MarketplaceGalleryImageInner update(String resourceGroupName, String marketplaceGalleryImageName, + MarketplaceGalleryImageTagsUpdate properties, Context context) { + return beginUpdate(resourceGroupName, marketplaceGalleryImageName, properties, context).getFinalResult(); + } + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 marketplaceGalleryImageName) { + 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 (marketplaceGalleryImageName == null) { + return Mono.error( + new IllegalArgumentException("Parameter marketplaceGalleryImageName is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, marketplaceGalleryImageName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String marketplaceGalleryImageName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (marketplaceGalleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter marketplaceGalleryImageName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, marketplaceGalleryImageName, Context.NONE); + } + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String marketplaceGalleryImageName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (marketplaceGalleryImageName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter marketplaceGalleryImageName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, marketplaceGalleryImageName, context); + } + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 marketplaceGalleryImageName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, marketplaceGalleryImageName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 marketplaceGalleryImageName) { + Response response = deleteWithResponse(resourceGroupName, marketplaceGalleryImageName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 marketplaceGalleryImageName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, marketplaceGalleryImageName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 marketplaceGalleryImageName) { + return beginDeleteAsync(resourceGroupName, marketplaceGalleryImageName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 marketplaceGalleryImageName) { + beginDelete(resourceGroupName, marketplaceGalleryImageName).getFinalResult(); + } + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 marketplaceGalleryImageName, Context context) { + beginDelete(resourceGroupName, marketplaceGalleryImageName, context).getFinalResult(); + } + + /** + * Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @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 MarketplaceGalleryImage 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())); + } + + /** + * Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @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 MarketplaceGalleryImage 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)); + } + + /** + * Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @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 MarketplaceGalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @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 MarketplaceGalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @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 MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @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 MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage 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())); + } + + /** + * Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listAllNextSinglePage(nextLink)); + } + + /** + * Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listAllNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(MarketplaceGalleryImagesClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/MarketplaceGalleryImagesImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/MarketplaceGalleryImagesImpl.java new file mode 100644 index 000000000000..a5317405f350 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/MarketplaceGalleryImagesImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.MarketplaceGalleryImageInner; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImage; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImages; + +public final class MarketplaceGalleryImagesImpl implements MarketplaceGalleryImages { + private static final ClientLogger LOGGER = new ClientLogger(MarketplaceGalleryImagesImpl.class); + + private final MarketplaceGalleryImagesClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public MarketplaceGalleryImagesImpl(MarketplaceGalleryImagesClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String marketplaceGalleryImageName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, marketplaceGalleryImageName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MarketplaceGalleryImageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MarketplaceGalleryImage getByResourceGroup(String resourceGroupName, String marketplaceGalleryImageName) { + MarketplaceGalleryImageInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, marketplaceGalleryImageName); + if (inner != null) { + return new MarketplaceGalleryImageImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String marketplaceGalleryImageName) { + this.serviceClient().delete(resourceGroupName, marketplaceGalleryImageName); + } + + public void delete(String resourceGroupName, String marketplaceGalleryImageName, Context context) { + this.serviceClient().delete(resourceGroupName, marketplaceGalleryImageName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MarketplaceGalleryImageImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MarketplaceGalleryImageImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MarketplaceGalleryImageImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MarketplaceGalleryImageImpl(inner1, this.manager())); + } + + public MarketplaceGalleryImage 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 marketplaceGalleryImageName = ResourceManagerUtils.getValueFromIdByName(id, "marketplaceGalleryImages"); + if (marketplaceGalleryImageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'marketplaceGalleryImages'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, marketplaceGalleryImageName, 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 marketplaceGalleryImageName = ResourceManagerUtils.getValueFromIdByName(id, "marketplaceGalleryImages"); + if (marketplaceGalleryImageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'marketplaceGalleryImages'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, marketplaceGalleryImageName, 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 marketplaceGalleryImageName = ResourceManagerUtils.getValueFromIdByName(id, "marketplaceGalleryImages"); + if (marketplaceGalleryImageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'marketplaceGalleryImages'.", id))); + } + this.delete(resourceGroupName, marketplaceGalleryImageName, 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 marketplaceGalleryImageName = ResourceManagerUtils.getValueFromIdByName(id, "marketplaceGalleryImages"); + if (marketplaceGalleryImageName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'marketplaceGalleryImages'.", id))); + } + this.delete(resourceGroupName, marketplaceGalleryImageName, context); + } + + private MarketplaceGalleryImagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + public MarketplaceGalleryImageImpl define(String name) { + return new MarketplaceGalleryImageImpl(name, this.manager()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkInterfaceImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkInterfaceImpl.java new file mode 100644 index 000000000000..9b1097c759cc --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkInterfaceImpl.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkInterfaceInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterface; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfacesUpdateProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfacesUpdateRequest; +import java.util.Collections; +import java.util.Map; + +public final class NetworkInterfaceImpl + implements NetworkInterface, NetworkInterface.Definition, NetworkInterface.Update { + private NetworkInterfaceInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager 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 NetworkInterfaceProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public NetworkInterfaceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String networkInterfaceName; + + private NetworkInterfacesUpdateRequest updateProperties; + + public NetworkInterfaceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public NetworkInterface create() { + this.innerObject = serviceManager.serviceClient() + .getNetworkInterfaces() + .createOrUpdate(resourceGroupName, networkInterfaceName, this.innerModel(), Context.NONE); + return this; + } + + public NetworkInterface create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNetworkInterfaces() + .createOrUpdate(resourceGroupName, networkInterfaceName, this.innerModel(), context); + return this; + } + + NetworkInterfaceImpl(String name, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = new NetworkInterfaceInner(); + this.serviceManager = serviceManager; + this.networkInterfaceName = name; + } + + public NetworkInterfaceImpl update() { + this.updateProperties = new NetworkInterfacesUpdateRequest(); + return this; + } + + public NetworkInterface apply() { + this.innerObject = serviceManager.serviceClient() + .getNetworkInterfaces() + .update(resourceGroupName, networkInterfaceName, updateProperties, Context.NONE); + return this; + } + + public NetworkInterface apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNetworkInterfaces() + .update(resourceGroupName, networkInterfaceName, updateProperties, context); + return this; + } + + NetworkInterfaceImpl(NetworkInterfaceInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.networkInterfaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "networkInterfaces"); + } + + public NetworkInterface refresh() { + this.innerObject = serviceManager.serviceClient() + .getNetworkInterfaces() + .getByResourceGroupWithResponse(resourceGroupName, networkInterfaceName, Context.NONE) + .getValue(); + return this; + } + + public NetworkInterface refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNetworkInterfaces() + .getByResourceGroupWithResponse(resourceGroupName, networkInterfaceName, context) + .getValue(); + return this; + } + + public NetworkInterfaceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public NetworkInterfaceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public NetworkInterfaceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public NetworkInterfaceImpl withProperties(NetworkInterfaceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public NetworkInterfaceImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public NetworkInterfaceImpl withProperties(NetworkInterfacesUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkInterfacesClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkInterfacesClientImpl.java new file mode 100644 index 000000000000..f13f9a60f486 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkInterfacesClientImpl.java @@ -0,0 +1,1478 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkInterfaceInner; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.NetworkInterfaceListResult; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfacesUpdateRequest; +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 NetworkInterfacesClient. + */ +public final class NetworkInterfacesClientImpl implements NetworkInterfacesClient { + /** + * The proxy service used to perform REST calls. + */ + private final NetworkInterfacesService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of NetworkInterfacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NetworkInterfacesClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service + = RestProxy.create(NetworkInterfacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientNetworkInterfaces to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientNetworkInterfaces") + public interface NetworkInterfacesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkInterfaceName") String networkInterfaceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkInterfaceName") String networkInterfaceName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkInterfaceName") String networkInterfaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NetworkInterfaceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkInterfaceName") String networkInterfaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NetworkInterfaceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkInterfaceName") String networkInterfaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NetworkInterfacesUpdateRequest properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkInterfaceName") String networkInterfaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NetworkInterfacesUpdateRequest properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkInterfaceName") String networkInterfaceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces/{networkInterfaceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkInterfaceName") String networkInterfaceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkInterfaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkInterfaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkInterfaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAllNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 network interface along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String networkInterfaceName) { + 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 (networkInterfaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkInterfaceName 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, networkInterfaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 network interface on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String networkInterfaceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, networkInterfaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 network interface along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String networkInterfaceName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkInterfaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkInterfaceName, accept, context); + } + + /** + * Gets a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 network interface. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkInterfaceInner getByResourceGroup(String resourceGroupName, String networkInterfaceName) { + return getByResourceGroupWithResponse(resourceGroupName, networkInterfaceName, Context.NONE).getValue(); + } + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String networkInterfaceName, NetworkInterfaceInner 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 (networkInterfaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkInterfaceName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkInterfaceName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String networkInterfaceName, + NetworkInterfaceInner resource) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkInterfaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkInterfaceName, contentType, accept, resource, + Context.NONE); + } + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String networkInterfaceName, + NetworkInterfaceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkInterfaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkInterfaceName, contentType, accept, resource, + context); + } + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 the network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NetworkInterfaceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String networkInterfaceName, NetworkInterfaceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, networkInterfaceName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NetworkInterfaceInner.class, NetworkInterfaceInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 the network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkInterfaceInner> + beginCreateOrUpdate(String resourceGroupName, String networkInterfaceName, NetworkInterfaceInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, networkInterfaceName, resource); + return this.client.getLroResult(response, + NetworkInterfaceInner.class, NetworkInterfaceInner.class, Context.NONE); + } + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 the network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkInterfaceInner> beginCreateOrUpdate( + String resourceGroupName, String networkInterfaceName, NetworkInterfaceInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, networkInterfaceName, resource, context); + return this.client.getLroResult(response, + NetworkInterfaceInner.class, NetworkInterfaceInner.class, context); + } + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String networkInterfaceName, + NetworkInterfaceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, networkInterfaceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkInterfaceInner createOrUpdate(String resourceGroupName, String networkInterfaceName, + NetworkInterfaceInner resource) { + return beginCreateOrUpdate(resourceGroupName, networkInterfaceName, resource).getFinalResult(); + } + + /** + * The operation to create or update a network interface. Please note some properties can be set only during network + * interface creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkInterfaceInner createOrUpdate(String resourceGroupName, String networkInterfaceName, + NetworkInterfaceInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, networkInterfaceName, resource, context).getFinalResult(); + } + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String networkInterfaceName, NetworkInterfacesUpdateRequest 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 (networkInterfaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkInterfaceName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkInterfaceName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String networkInterfaceName, + NetworkInterfacesUpdateRequest properties) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkInterfaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkInterfaceName, contentType, accept, properties, + Context.NONE); + } + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String networkInterfaceName, + NetworkInterfacesUpdateRequest properties, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkInterfaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkInterfaceName, contentType, accept, properties, + context); + } + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 the network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NetworkInterfaceInner> beginUpdateAsync( + String resourceGroupName, String networkInterfaceName, NetworkInterfacesUpdateRequest properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, networkInterfaceName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NetworkInterfaceInner.class, NetworkInterfaceInner.class, + this.client.getContext()); + } + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 the network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkInterfaceInner> beginUpdate(String resourceGroupName, + String networkInterfaceName, NetworkInterfacesUpdateRequest properties) { + Response response = updateWithResponse(resourceGroupName, networkInterfaceName, properties); + return this.client.getLroResult(response, + NetworkInterfaceInner.class, NetworkInterfaceInner.class, Context.NONE); + } + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 the network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkInterfaceInner> beginUpdate(String resourceGroupName, + String networkInterfaceName, NetworkInterfacesUpdateRequest properties, Context context) { + Response response + = updateWithResponse(resourceGroupName, networkInterfaceName, properties, context); + return this.client.getLroResult(response, + NetworkInterfaceInner.class, NetworkInterfaceInner.class, context); + } + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String networkInterfaceName, + NetworkInterfacesUpdateRequest properties) { + return beginUpdateAsync(resourceGroupName, networkInterfaceName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkInterfaceInner update(String resourceGroupName, String networkInterfaceName, + NetworkInterfacesUpdateRequest properties) { + return beginUpdate(resourceGroupName, networkInterfaceName, properties).getFinalResult(); + } + + /** + * The operation to update a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @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 network interface resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkInterfaceInner update(String resourceGroupName, String networkInterfaceName, + NetworkInterfacesUpdateRequest properties, Context context) { + return beginUpdate(resourceGroupName, networkInterfaceName, properties, context).getFinalResult(); + } + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 networkInterfaceName) { + 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 (networkInterfaceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkInterfaceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String networkInterfaceName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkInterfaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkInterfaceName, Context.NONE); + } + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String networkInterfaceName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkInterfaceName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter networkInterfaceName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkInterfaceName, context); + } + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 networkInterfaceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, networkInterfaceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 networkInterfaceName) { + Response response = deleteWithResponse(resourceGroupName, networkInterfaceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 networkInterfaceName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, networkInterfaceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 networkInterfaceName) { + return beginDeleteAsync(resourceGroupName, networkInterfaceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 networkInterfaceName) { + beginDelete(resourceGroupName, networkInterfaceName).getFinalResult(); + } + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 networkInterfaceName, Context context) { + beginDelete(resourceGroupName, networkInterfaceName, context).getFinalResult(); + } + + /** + * Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @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 NetworkInterface 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())); + } + + /** + * Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @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 NetworkInterface 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)); + } + + /** + * Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @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 NetworkInterface list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @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 NetworkInterface list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @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 NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @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 NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface 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())); + } + + /** + * Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listAllNextSinglePage(nextLink)); + } + + /** + * Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listAllNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(NetworkInterfacesClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkInterfacesImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkInterfacesImpl.java new file mode 100644 index 000000000000..f248eebfe8de --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkInterfacesImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.NetworkInterfacesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkInterfaceInner; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterface; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaces; + +public final class NetworkInterfacesImpl implements NetworkInterfaces { + private static final ClientLogger LOGGER = new ClientLogger(NetworkInterfacesImpl.class); + + private final NetworkInterfacesClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public NetworkInterfacesImpl(NetworkInterfacesClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String networkInterfaceName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, networkInterfaceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new NetworkInterfaceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NetworkInterface getByResourceGroup(String resourceGroupName, String networkInterfaceName) { + NetworkInterfaceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, networkInterfaceName); + if (inner != null) { + return new NetworkInterfaceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String networkInterfaceName) { + this.serviceClient().delete(resourceGroupName, networkInterfaceName); + } + + public void delete(String resourceGroupName, String networkInterfaceName, Context context) { + this.serviceClient().delete(resourceGroupName, networkInterfaceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NetworkInterfaceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NetworkInterfaceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NetworkInterfaceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NetworkInterfaceImpl(inner1, this.manager())); + } + + public NetworkInterface 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 networkInterfaceName = ResourceManagerUtils.getValueFromIdByName(id, "networkInterfaces"); + if (networkInterfaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkInterfaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, networkInterfaceName, 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 networkInterfaceName = ResourceManagerUtils.getValueFromIdByName(id, "networkInterfaces"); + if (networkInterfaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkInterfaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, networkInterfaceName, 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 networkInterfaceName = ResourceManagerUtils.getValueFromIdByName(id, "networkInterfaces"); + if (networkInterfaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkInterfaces'.", id))); + } + this.delete(resourceGroupName, networkInterfaceName, 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 networkInterfaceName = ResourceManagerUtils.getValueFromIdByName(id, "networkInterfaces"); + if (networkInterfaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkInterfaces'.", id))); + } + this.delete(resourceGroupName, networkInterfaceName, context); + } + + private NetworkInterfacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + public NetworkInterfaceImpl define(String name) { + return new NetworkInterfaceImpl(name, this.manager()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkSecurityGroupImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkSecurityGroupImpl.java new file mode 100644 index 000000000000..6c4c9b752a4e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkSecurityGroupImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkSecurityGroupInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroup; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupTagsUpdate; +import java.util.Collections; +import java.util.Map; + +public final class NetworkSecurityGroupImpl + implements NetworkSecurityGroup, NetworkSecurityGroup.Definition, NetworkSecurityGroup.Update { + private NetworkSecurityGroupInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager 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 NetworkSecurityGroupProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public String eTag() { + return this.innerModel().eTag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public NetworkSecurityGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String networkSecurityGroupName; + + private NetworkSecurityGroupTagsUpdate updateProperties; + + public NetworkSecurityGroupImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public NetworkSecurityGroup create() { + this.innerObject = serviceManager.serviceClient() + .getNetworkSecurityGroups() + .createOrUpdate(resourceGroupName, networkSecurityGroupName, this.innerModel(), Context.NONE); + return this; + } + + public NetworkSecurityGroup create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNetworkSecurityGroups() + .createOrUpdate(resourceGroupName, networkSecurityGroupName, this.innerModel(), context); + return this; + } + + NetworkSecurityGroupImpl(String name, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = new NetworkSecurityGroupInner(); + this.serviceManager = serviceManager; + this.networkSecurityGroupName = name; + } + + public NetworkSecurityGroupImpl update() { + this.updateProperties = new NetworkSecurityGroupTagsUpdate(); + return this; + } + + public NetworkSecurityGroup apply() { + this.innerObject = serviceManager.serviceClient() + .getNetworkSecurityGroups() + .updateTags(resourceGroupName, networkSecurityGroupName, updateProperties, Context.NONE); + return this; + } + + public NetworkSecurityGroup apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNetworkSecurityGroups() + .updateTags(resourceGroupName, networkSecurityGroupName, updateProperties, context); + return this; + } + + NetworkSecurityGroupImpl(NetworkSecurityGroupInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.networkSecurityGroupName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "networkSecurityGroups"); + } + + public NetworkSecurityGroup refresh() { + this.innerObject = serviceManager.serviceClient() + .getNetworkSecurityGroups() + .getByResourceGroupWithResponse(resourceGroupName, networkSecurityGroupName, Context.NONE) + .getValue(); + return this; + } + + public NetworkSecurityGroup refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNetworkSecurityGroups() + .getByResourceGroupWithResponse(resourceGroupName, networkSecurityGroupName, context) + .getValue(); + return this; + } + + public NetworkSecurityGroupImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public NetworkSecurityGroupImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public NetworkSecurityGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public NetworkSecurityGroupImpl withProperties(NetworkSecurityGroupProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public NetworkSecurityGroupImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkSecurityGroupsClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkSecurityGroupsClientImpl.java new file mode 100644 index 000000000000..891583c923d5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkSecurityGroupsClientImpl.java @@ -0,0 +1,1470 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkSecurityGroupInner; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.NetworkSecurityGroupListResult; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupTagsUpdate; +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 NetworkSecurityGroupsClient. + */ +public final class NetworkSecurityGroupsClientImpl implements NetworkSecurityGroupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final NetworkSecurityGroupsService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of NetworkSecurityGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NetworkSecurityGroupsClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service = RestProxy.create(NetworkSecurityGroupsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientNetworkSecurityGroups to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientNetworkSecurityGroups") + public interface NetworkSecurityGroupsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NetworkSecurityGroupInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NetworkSecurityGroupInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateTags(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NetworkSecurityGroupTagsUpdate properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateTagsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NetworkSecurityGroupTagsUpdate properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkSecurityGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/networkSecurityGroups") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAllNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified network security group along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String networkSecurityGroupName) { + 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 (networkSecurityGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter networkSecurityGroupName 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, networkSecurityGroupName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified network security group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String networkSecurityGroupName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, networkSecurityGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified network security group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String networkSecurityGroupName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, accept, context); + } + + /** + * Gets the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified network security group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkSecurityGroupInner getByResourceGroup(String resourceGroupName, String networkSecurityGroupName) { + return getByResourceGroupWithResponse(resourceGroupName, networkSecurityGroupName, Context.NONE).getValue(); + } + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String networkSecurityGroupName, NetworkSecurityGroupInner 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 (networkSecurityGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter networkSecurityGroupName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupInner resource) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, contentType, accept, resource, + Context.NONE); + } + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupInner resource, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, contentType, accept, resource, + context); + } + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NetworkSecurityGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, networkSecurityGroupName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NetworkSecurityGroupInner.class, NetworkSecurityGroupInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkSecurityGroupInner> beginCreateOrUpdate( + String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, networkSecurityGroupName, resource); + return this.client.getLroResult(response, + NetworkSecurityGroupInner.class, NetworkSecurityGroupInner.class, Context.NONE); + } + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkSecurityGroupInner> beginCreateOrUpdate( + String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner resource, + Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, networkSecurityGroupName, resource, context); + return this.client.getLroResult(response, + NetworkSecurityGroupInner.class, NetworkSecurityGroupInner.class, context); + } + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String networkSecurityGroupName, NetworkSecurityGroupInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, networkSecurityGroupName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkSecurityGroupInner createOrUpdate(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupInner resource) { + return beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, resource).getFinalResult(); + } + + /** + * Creates or updates a network security group in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkSecurityGroupInner createOrUpdate(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, resource, context).getFinalResult(); + } + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateTagsWithResponseAsync(String resourceGroupName, + String networkSecurityGroupName, NetworkSecurityGroupTagsUpdate 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 (networkSecurityGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter networkSecurityGroupName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.updateTags(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateTagsWithResponse(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupTagsUpdate properties) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateTagsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, contentType, accept, + properties, Context.NONE); + } + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateTagsWithResponse(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupTagsUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateTagsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, contentType, accept, + properties, context); + } + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NetworkSecurityGroupInner> beginUpdateTagsAsync( + String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupTagsUpdate properties) { + Mono>> mono + = updateTagsWithResponseAsync(resourceGroupName, networkSecurityGroupName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), NetworkSecurityGroupInner.class, NetworkSecurityGroupInner.class, + this.client.getContext()); + } + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkSecurityGroupInner> beginUpdateTags( + String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupTagsUpdate properties) { + Response response = updateTagsWithResponse(resourceGroupName, networkSecurityGroupName, properties); + return this.client.getLroResult(response, + NetworkSecurityGroupInner.class, NetworkSecurityGroupInner.class, Context.NONE); + } + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NetworkSecurityGroupInner> beginUpdateTags( + String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupTagsUpdate properties, + Context context) { + Response response + = updateTagsWithResponse(resourceGroupName, networkSecurityGroupName, properties, context); + return this.client.getLroResult(response, + NetworkSecurityGroupInner.class, NetworkSecurityGroupInner.class, context); + } + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupTagsUpdate properties) { + return beginUpdateTagsAsync(resourceGroupName, networkSecurityGroupName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkSecurityGroupInner updateTags(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupTagsUpdate properties) { + return beginUpdateTags(resourceGroupName, networkSecurityGroupName, properties).getFinalResult(); + } + + /** + * Updates a network security group tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @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 networkSecurityGroup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NetworkSecurityGroupInner updateTags(String resourceGroupName, String networkSecurityGroupName, + NetworkSecurityGroupTagsUpdate properties, Context context) { + return beginUpdateTags(resourceGroupName, networkSecurityGroupName, properties, context).getFinalResult(); + } + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 networkSecurityGroupName) { + 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 (networkSecurityGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String networkSecurityGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, Context.NONE); + } + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String networkSecurityGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, context); + } + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 networkSecurityGroupName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, networkSecurityGroupName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 networkSecurityGroupName) { + Response response = deleteWithResponse(resourceGroupName, networkSecurityGroupName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 networkSecurityGroupName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, networkSecurityGroupName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 networkSecurityGroupName) { + return beginDeleteAsync(resourceGroupName, networkSecurityGroupName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 networkSecurityGroupName) { + beginDelete(resourceGroupName, networkSecurityGroupName).getFinalResult(); + } + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 networkSecurityGroupName, Context context) { + beginDelete(resourceGroupName, networkSecurityGroupName, context).getFinalResult(); + } + + /** + * Gets all network security groups in a 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 all network security groups in a resource group 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())); + } + + /** + * Gets all network security groups in a 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 all network security groups in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all network security groups in a 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 all network security groups in a resource group along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets all network security groups in a 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 all network security groups in a resource group along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets all network security groups in a 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 all network security groups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * Gets all network security groups in a 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 all network security groups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Gets all network security groups in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription 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())); + } + + /** + * Gets all network security groups in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Gets all network security groups in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets all network security groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets all network security groups in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listAllNextSinglePage(nextLink)); + } + + /** + * Gets all network security groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listAllNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a resource group 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a resource group along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a resource group along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(NetworkSecurityGroupsClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkSecurityGroupsImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkSecurityGroupsImpl.java new file mode 100644 index 000000000000..758d99b2bfb4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/NetworkSecurityGroupsImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.NetworkSecurityGroupsClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkSecurityGroupInner; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroup; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroups; + +public final class NetworkSecurityGroupsImpl implements NetworkSecurityGroups { + private static final ClientLogger LOGGER = new ClientLogger(NetworkSecurityGroupsImpl.class); + + private final NetworkSecurityGroupsClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public NetworkSecurityGroupsImpl(NetworkSecurityGroupsClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String networkSecurityGroupName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, networkSecurityGroupName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new NetworkSecurityGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NetworkSecurityGroup getByResourceGroup(String resourceGroupName, String networkSecurityGroupName) { + NetworkSecurityGroupInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, networkSecurityGroupName); + if (inner != null) { + return new NetworkSecurityGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String networkSecurityGroupName) { + this.serviceClient().delete(resourceGroupName, networkSecurityGroupName); + } + + public void delete(String resourceGroupName, String networkSecurityGroupName, Context context) { + this.serviceClient().delete(resourceGroupName, networkSecurityGroupName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NetworkSecurityGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NetworkSecurityGroupImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NetworkSecurityGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NetworkSecurityGroupImpl(inner1, this.manager())); + } + + public NetworkSecurityGroup 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 networkSecurityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "networkSecurityGroups"); + if (networkSecurityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkSecurityGroups'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, networkSecurityGroupName, 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 networkSecurityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "networkSecurityGroups"); + if (networkSecurityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkSecurityGroups'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, networkSecurityGroupName, 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 networkSecurityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "networkSecurityGroups"); + if (networkSecurityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkSecurityGroups'.", id))); + } + this.delete(resourceGroupName, networkSecurityGroupName, 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 networkSecurityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "networkSecurityGroups"); + if (networkSecurityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkSecurityGroups'.", id))); + } + this.delete(resourceGroupName, networkSecurityGroupName, context); + } + + private NetworkSecurityGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + public NetworkSecurityGroupImpl define(String name) { + return new NetworkSecurityGroupImpl(name, this.manager()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/ResourceManagerUtils.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..e03cd38e36ba --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/SecurityRuleImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/SecurityRuleImpl.java new file mode 100644 index 000000000000..d72367828795 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/SecurityRuleImpl.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.SecurityRuleInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRule; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProperties; + +public final class SecurityRuleImpl implements SecurityRule, SecurityRule.Definition, SecurityRule.Update { + private SecurityRuleInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SecurityRuleProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SecurityRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String networkSecurityGroupName; + + private String securityRuleName; + + public SecurityRuleImpl withExistingNetworkSecurityGroup(String resourceGroupName, + String networkSecurityGroupName) { + this.resourceGroupName = resourceGroupName; + this.networkSecurityGroupName = networkSecurityGroupName; + return this; + } + + public SecurityRule create() { + this.innerObject = serviceManager.serviceClient() + .getSecurityRules() + .createOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, this.innerModel(), + Context.NONE); + return this; + } + + public SecurityRule create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecurityRules() + .createOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, this.innerModel(), context); + return this; + } + + SecurityRuleImpl(String name, com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = new SecurityRuleInner(); + this.serviceManager = serviceManager; + this.securityRuleName = name; + } + + public SecurityRuleImpl update() { + return this; + } + + public SecurityRule apply() { + this.innerObject = serviceManager.serviceClient() + .getSecurityRules() + .createOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, this.innerModel(), + Context.NONE); + return this; + } + + public SecurityRule apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecurityRules() + .createOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, this.innerModel(), context); + return this; + } + + SecurityRuleImpl(SecurityRuleInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.networkSecurityGroupName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "networkSecurityGroups"); + this.securityRuleName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "securityRules"); + } + + public SecurityRule refresh() { + this.innerObject = serviceManager.serviceClient() + .getSecurityRules() + .getWithResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, Context.NONE) + .getValue(); + return this; + } + + public SecurityRule refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSecurityRules() + .getWithResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, context) + .getValue(); + return this; + } + + public SecurityRuleImpl withProperties(SecurityRuleProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public SecurityRuleImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/SecurityRulesClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/SecurityRulesClientImpl.java new file mode 100644 index 000000000000..3d6afdb2501b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/SecurityRulesClientImpl.java @@ -0,0 +1,1062 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.SecurityRuleInner; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.SecurityRuleListResult; +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 SecurityRulesClient. + */ +public final class SecurityRulesClientImpl implements SecurityRulesClient { + /** + * The proxy service used to perform REST calls. + */ + private final SecurityRulesService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of SecurityRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SecurityRulesClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service + = RestProxy.create(SecurityRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientSecurityRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientSecurityRules") + public interface SecurityRulesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @PathParam("securityRuleName") String securityRuleName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @PathParam("securityRuleName") String securityRuleName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @PathParam("securityRuleName") String securityRuleName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SecurityRuleInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @PathParam("securityRuleName") String securityRuleName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SecurityRuleInner resource, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @PathParam("securityRuleName") String securityRuleName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}/securityRules/{securityRuleName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @PathParam("securityRuleName") String securityRuleName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}/securityRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByNetworkSecurityGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/networkSecurityGroups/{networkSecurityGroupName}/securityRules") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByNetworkSecurityGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("networkSecurityGroupName") String networkSecurityGroupName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByNetworkSecurityGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByNetworkSecurityGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified security rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String networkSecurityGroupName, String securityRuleName) { + 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 (networkSecurityGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (securityRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityRuleName 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, networkSecurityGroupName, securityRuleName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified security rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName) { + return getWithResponseAsync(resourceGroupName, networkSecurityGroupName, securityRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified security rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (securityRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityRuleName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, networkSecurityGroupName, securityRuleName, accept, context); + } + + /** + * Gets the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified security rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityRuleInner get(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) { + return getWithResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, Context.NONE).getValue(); + } + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String networkSecurityGroupName, String securityRuleName, SecurityRuleInner 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 (networkSecurityGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (securityRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityRuleName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, securityRuleName, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName, SecurityRuleInner resource) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (securityRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityRuleName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, securityRuleName, contentType, + accept, resource, Context.NONE); + } + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName, SecurityRuleInner resource, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (securityRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityRuleName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, securityRuleName, contentType, + accept, resource, context); + } + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SecurityRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String networkSecurityGroupName, String securityRuleName, + SecurityRuleInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, networkSecurityGroupName, securityRuleName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + SecurityRuleInner.class, SecurityRuleInner.class, this.client.getContext()); + } + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SecurityRuleInner> beginCreateOrUpdate(String resourceGroupName, + String networkSecurityGroupName, String securityRuleName, SecurityRuleInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, resource); + return this.client.getLroResult(response, SecurityRuleInner.class, + SecurityRuleInner.class, Context.NONE); + } + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SecurityRuleInner> beginCreateOrUpdate(String resourceGroupName, + String networkSecurityGroupName, String securityRuleName, SecurityRuleInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, networkSecurityGroupName, + securityRuleName, resource, context); + return this.client.getLroResult(response, SecurityRuleInner.class, + SecurityRuleInner.class, context); + } + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName, SecurityRuleInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, networkSecurityGroupName, securityRuleName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityRuleInner createOrUpdate(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName, SecurityRuleInner resource) { + return beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, resource) + .getFinalResult(); + } + + /** + * Creates or updates a security rule in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @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 security Rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SecurityRuleInner createOrUpdate(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName, SecurityRuleInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, networkSecurityGroupName, securityRuleName, resource, context) + .getFinalResult(); + } + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 networkSecurityGroupName, String securityRuleName) { + 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 (networkSecurityGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (securityRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter securityRuleName is required and cannot be null.")); + } + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, securityRuleName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (securityRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityRuleName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, securityRuleName, + Context.NONE); + } + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + if (securityRuleName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter securityRuleName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, securityRuleName, context); + } + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 networkSecurityGroupName, String securityRuleName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, networkSecurityGroupName, securityRuleName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 networkSecurityGroupName, + String securityRuleName) { + Response response + = deleteWithResponse(resourceGroupName, networkSecurityGroupName, securityRuleName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 networkSecurityGroupName, + String securityRuleName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 networkSecurityGroupName, String securityRuleName) { + return beginDeleteAsync(resourceGroupName, networkSecurityGroupName, securityRuleName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 networkSecurityGroupName, String securityRuleName) { + beginDelete(resourceGroupName, networkSecurityGroupName, securityRuleName).getFinalResult(); + } + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 networkSecurityGroupName, String securityRuleName, + Context context) { + beginDelete(resourceGroupName, networkSecurityGroupName, securityRuleName, context).getFinalResult(); + } + + /** + * Gets all security rules in a Network Security Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNetworkSecurityGroupSinglePageAsync(String resourceGroupName, + String networkSecurityGroupName) { + 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 (networkSecurityGroupName == null) { + return Mono.error( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByNetworkSecurityGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, 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())); + } + + /** + * Gets all security rules in a Network Security Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByNetworkSecurityGroupAsync(String resourceGroupName, + String networkSecurityGroupName) { + return new PagedFlux<>( + () -> listByNetworkSecurityGroupSinglePageAsync(resourceGroupName, networkSecurityGroupName), + nextLink -> listByNetworkSecurityGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all security rules in a Network Security Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByNetworkSecurityGroupSinglePage(String resourceGroupName, + String networkSecurityGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByNetworkSecurityGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets all security rules in a Network Security Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByNetworkSecurityGroupSinglePage(String resourceGroupName, + String networkSecurityGroupName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (networkSecurityGroupName == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Parameter networkSecurityGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByNetworkSecurityGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, networkSecurityGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets all security rules in a Network Security Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByNetworkSecurityGroup(String resourceGroupName, + String networkSecurityGroupName) { + return new PagedIterable<>( + () -> listByNetworkSecurityGroupSinglePage(resourceGroupName, networkSecurityGroupName), + nextLink -> listByNetworkSecurityGroupNextSinglePage(nextLink)); + } + + /** + * Gets all security rules in a Network Security Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByNetworkSecurityGroup(String resourceGroupName, + String networkSecurityGroupName, Context context) { + return new PagedIterable<>( + () -> listByNetworkSecurityGroupSinglePage(resourceGroupName, networkSecurityGroupName, context), + nextLink -> listByNetworkSecurityGroupNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNetworkSecurityGroupNextSinglePageAsync(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.listByNetworkSecurityGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByNetworkSecurityGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByNetworkSecurityGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByNetworkSecurityGroupNextSinglePage(String nextLink, + Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByNetworkSecurityGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityRulesClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/SecurityRulesImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/SecurityRulesImpl.java new file mode 100644 index 000000000000..0375e007b4f5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/SecurityRulesImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.SecurityRulesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.SecurityRuleInner; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRule; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRules; + +public final class SecurityRulesImpl implements SecurityRules { + private static final ClientLogger LOGGER = new ClientLogger(SecurityRulesImpl.class); + + private final SecurityRulesClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public SecurityRulesImpl(SecurityRulesClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SecurityRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SecurityRule get(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) { + SecurityRuleInner inner + = this.serviceClient().get(resourceGroupName, networkSecurityGroupName, securityRuleName); + if (inner != null) { + return new SecurityRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String networkSecurityGroupName, String securityRuleName) { + this.serviceClient().delete(resourceGroupName, networkSecurityGroupName, securityRuleName); + } + + public void delete(String resourceGroupName, String networkSecurityGroupName, String securityRuleName, + Context context) { + this.serviceClient().delete(resourceGroupName, networkSecurityGroupName, securityRuleName, context); + } + + public PagedIterable listByNetworkSecurityGroup(String resourceGroupName, + String networkSecurityGroupName) { + PagedIterable inner + = this.serviceClient().listByNetworkSecurityGroup(resourceGroupName, networkSecurityGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByNetworkSecurityGroup(String resourceGroupName, + String networkSecurityGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByNetworkSecurityGroup(resourceGroupName, networkSecurityGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SecurityRuleImpl(inner1, this.manager())); + } + + public SecurityRule 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 networkSecurityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "networkSecurityGroups"); + if (networkSecurityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkSecurityGroups'.", id))); + } + String securityRuleName = ResourceManagerUtils.getValueFromIdByName(id, "securityRules"); + if (securityRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityRules'.", id))); + } + return this.getWithResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, 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 networkSecurityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "networkSecurityGroups"); + if (networkSecurityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkSecurityGroups'.", id))); + } + String securityRuleName = ResourceManagerUtils.getValueFromIdByName(id, "securityRules"); + if (securityRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityRules'.", id))); + } + return this.getWithResponse(resourceGroupName, networkSecurityGroupName, securityRuleName, 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 networkSecurityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "networkSecurityGroups"); + if (networkSecurityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkSecurityGroups'.", id))); + } + String securityRuleName = ResourceManagerUtils.getValueFromIdByName(id, "securityRules"); + if (securityRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityRules'.", id))); + } + this.delete(resourceGroupName, networkSecurityGroupName, securityRuleName, 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 networkSecurityGroupName = ResourceManagerUtils.getValueFromIdByName(id, "networkSecurityGroups"); + if (networkSecurityGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'networkSecurityGroups'.", id))); + } + String securityRuleName = ResourceManagerUtils.getValueFromIdByName(id, "securityRules"); + if (securityRuleName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'securityRules'.", id))); + } + this.delete(resourceGroupName, networkSecurityGroupName, securityRuleName, context); + } + + private SecurityRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + public SecurityRuleImpl define(String name) { + return new SecurityRuleImpl(name, this.manager()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/StorageContainerImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/StorageContainerImpl.java new file mode 100644 index 000000000000..c3b0e912b623 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/StorageContainerImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.StorageContainerInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainer; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerTagsUpdate; +import java.util.Collections; +import java.util.Map; + +public final class StorageContainerImpl + implements StorageContainer, StorageContainer.Definition, StorageContainer.Update { + private StorageContainerInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager 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 StorageContainerProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public StorageContainerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String storageContainerName; + + private StorageContainerTagsUpdate updateProperties; + + public StorageContainerImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public StorageContainer create() { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .createOrUpdate(resourceGroupName, storageContainerName, this.innerModel(), Context.NONE); + return this; + } + + public StorageContainer create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .createOrUpdate(resourceGroupName, storageContainerName, this.innerModel(), context); + return this; + } + + StorageContainerImpl(String name, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = new StorageContainerInner(); + this.serviceManager = serviceManager; + this.storageContainerName = name; + } + + public StorageContainerImpl update() { + this.updateProperties = new StorageContainerTagsUpdate(); + return this; + } + + public StorageContainer apply() { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .update(resourceGroupName, storageContainerName, updateProperties, Context.NONE); + return this; + } + + public StorageContainer apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .update(resourceGroupName, storageContainerName, updateProperties, context); + return this; + } + + StorageContainerImpl(StorageContainerInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.storageContainerName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "storageContainers"); + } + + public StorageContainer refresh() { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .getByResourceGroupWithResponse(resourceGroupName, storageContainerName, Context.NONE) + .getValue(); + return this; + } + + public StorageContainer refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .getByResourceGroupWithResponse(resourceGroupName, storageContainerName, context) + .getValue(); + return this; + } + + public StorageContainerImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public StorageContainerImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public StorageContainerImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public StorageContainerImpl withProperties(StorageContainerProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public StorageContainerImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/StorageContainersClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/StorageContainersClientImpl.java new file mode 100644 index 000000000000..96c6d5d6974f --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/StorageContainersClientImpl.java @@ -0,0 +1,1478 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.StorageContainerInner; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.StorageContainerListResult; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerTagsUpdate; +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 StorageContainersClient. + */ +public final class StorageContainersClientImpl implements StorageContainersClient { + /** + * The proxy service used to perform REST calls. + */ + private final StorageContainersService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of StorageContainersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StorageContainersClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service + = RestProxy.create(StorageContainersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientStorageContainers to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientStorageContainers") + public interface StorageContainersService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StorageContainerInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StorageContainerInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StorageContainerTagsUpdate properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StorageContainerTagsUpdate properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers/{storageContainerName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/storageContainers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storageContainers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/storageContainers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAllNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 storage container along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String storageContainerName) { + 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 (storageContainerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageContainerName 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, storageContainerName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 storage container on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String storageContainerName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, storageContainerName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 storage container along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String storageContainerName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageContainerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter storageContainerName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, accept, context); + } + + /** + * Gets a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 storage container. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageContainerInner getByResourceGroup(String resourceGroupName, String storageContainerName) { + return getByResourceGroupWithResponse(resourceGroupName, storageContainerName, Context.NONE).getValue(); + } + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String storageContainerName, StorageContainerInner 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 (storageContainerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageContainerName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String storageContainerName, + StorageContainerInner resource) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageContainerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter storageContainerName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, resource, + Context.NONE); + } + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String storageContainerName, + StorageContainerInner resource, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageContainerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter storageContainerName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, resource, + context); + } + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 the storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageContainerInner> beginCreateOrUpdateAsync( + String resourceGroupName, String storageContainerName, StorageContainerInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, storageContainerName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), StorageContainerInner.class, StorageContainerInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 the storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageContainerInner> + beginCreateOrUpdate(String resourceGroupName, String storageContainerName, StorageContainerInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, storageContainerName, resource); + return this.client.getLroResult(response, + StorageContainerInner.class, StorageContainerInner.class, Context.NONE); + } + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 the storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageContainerInner> beginCreateOrUpdate( + String resourceGroupName, String storageContainerName, StorageContainerInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, storageContainerName, resource, context); + return this.client.getLroResult(response, + StorageContainerInner.class, StorageContainerInner.class, context); + } + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String storageContainerName, + StorageContainerInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, storageContainerName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageContainerInner createOrUpdate(String resourceGroupName, String storageContainerName, + StorageContainerInner resource) { + return beginCreateOrUpdate(resourceGroupName, storageContainerName, resource).getFinalResult(); + } + + /** + * The operation to create or update a storage container. Please note some properties can be set only during storage + * container creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageContainerInner createOrUpdate(String resourceGroupName, String storageContainerName, + StorageContainerInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, storageContainerName, resource, context).getFinalResult(); + } + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String storageContainerName, StorageContainerTagsUpdate 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 (storageContainerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageContainerName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String storageContainerName, + StorageContainerTagsUpdate properties) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageContainerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter storageContainerName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, properties, + Context.NONE); + } + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String storageContainerName, + StorageContainerTagsUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageContainerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter storageContainerName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, properties, + context); + } + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 the storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageContainerInner> + beginUpdateAsync(String resourceGroupName, String storageContainerName, StorageContainerTagsUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, storageContainerName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), StorageContainerInner.class, StorageContainerInner.class, + this.client.getContext()); + } + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 the storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageContainerInner> beginUpdate(String resourceGroupName, + String storageContainerName, StorageContainerTagsUpdate properties) { + Response response = updateWithResponse(resourceGroupName, storageContainerName, properties); + return this.client.getLroResult(response, + StorageContainerInner.class, StorageContainerInner.class, Context.NONE); + } + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 the storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageContainerInner> beginUpdate(String resourceGroupName, + String storageContainerName, StorageContainerTagsUpdate properties, Context context) { + Response response + = updateWithResponse(resourceGroupName, storageContainerName, properties, context); + return this.client.getLroResult(response, + StorageContainerInner.class, StorageContainerInner.class, context); + } + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String storageContainerName, + StorageContainerTagsUpdate properties) { + return beginUpdateAsync(resourceGroupName, storageContainerName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageContainerInner update(String resourceGroupName, String storageContainerName, + StorageContainerTagsUpdate properties) { + return beginUpdate(resourceGroupName, storageContainerName, properties).getFinalResult(); + } + + /** + * The operation to update a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @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 storage container resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageContainerInner update(String resourceGroupName, String storageContainerName, + StorageContainerTagsUpdate properties, Context context) { + return beginUpdate(resourceGroupName, storageContainerName, properties, context).getFinalResult(); + } + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 storageContainerName) { + 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 (storageContainerName == null) { + return Mono + .error(new IllegalArgumentException("Parameter storageContainerName is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String storageContainerName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageContainerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter storageContainerName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, Context.NONE); + } + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String storageContainerName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (storageContainerName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter storageContainerName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, context); + } + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 storageContainerName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, storageContainerName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 storageContainerName) { + Response response = deleteWithResponse(resourceGroupName, storageContainerName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 storageContainerName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, storageContainerName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 storageContainerName) { + return beginDeleteAsync(resourceGroupName, storageContainerName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 storageContainerName) { + beginDelete(resourceGroupName, storageContainerName).getFinalResult(); + } + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 storageContainerName, Context context) { + beginDelete(resourceGroupName, storageContainerName, context).getFinalResult(); + } + + /** + * Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @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 StorageContainer 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())); + } + + /** + * Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @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 StorageContainer 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)); + } + + /** + * Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @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 StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @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 StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @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 StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @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 StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer 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())); + } + + /** + * Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listAllNextSinglePage(nextLink)); + } + + /** + * Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listAllNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageContainersClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/StorageContainersImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/StorageContainersImpl.java new file mode 100644 index 000000000000..06f1f4732ba5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/StorageContainersImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.StorageContainersClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.StorageContainerInner; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainer; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainers; + +public final class StorageContainersImpl implements StorageContainers { + private static final ClientLogger LOGGER = new ClientLogger(StorageContainersImpl.class); + + private final StorageContainersClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public StorageContainersImpl(StorageContainersClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String storageContainerName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, storageContainerName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StorageContainerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public StorageContainer getByResourceGroup(String resourceGroupName, String storageContainerName) { + StorageContainerInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, storageContainerName); + if (inner != null) { + return new StorageContainerImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String storageContainerName) { + this.serviceClient().delete(resourceGroupName, storageContainerName); + } + + public void delete(String resourceGroupName, String storageContainerName, Context context) { + this.serviceClient().delete(resourceGroupName, storageContainerName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageContainerImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageContainerImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageContainerImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageContainerImpl(inner1, this.manager())); + } + + public StorageContainer 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 storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, storageContainerName, 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 storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, storageContainerName, 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 storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + this.delete(resourceGroupName, storageContainerName, 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 storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + this.delete(resourceGroupName, storageContainerName, context); + } + + private StorageContainersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + public StorageContainerImpl define(String name) { + return new StorageContainerImpl(name, this.manager()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDiskImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDiskImpl.java new file mode 100644 index 000000000000..9286cd2495db --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDiskImpl.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisk; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadRequest; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadResponse; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisksUpdateProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisksUpdateRequest; +import java.util.Collections; +import java.util.Map; + +public final class VirtualHardDiskImpl implements VirtualHardDisk, VirtualHardDisk.Definition, VirtualHardDisk.Update { + private VirtualHardDiskInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager 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 VirtualHardDiskProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public VirtualHardDiskInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String virtualHardDiskName; + + private VirtualHardDisksUpdateRequest updateProperties; + + public VirtualHardDiskImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public VirtualHardDisk create() { + this.innerObject = serviceManager.serviceClient() + .getVirtualHardDisks() + .createOrUpdate(resourceGroupName, virtualHardDiskName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualHardDisk create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVirtualHardDisks() + .createOrUpdate(resourceGroupName, virtualHardDiskName, this.innerModel(), context); + return this; + } + + VirtualHardDiskImpl(String name, com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = new VirtualHardDiskInner(); + this.serviceManager = serviceManager; + this.virtualHardDiskName = name; + } + + public VirtualHardDiskImpl update() { + this.updateProperties = new VirtualHardDisksUpdateRequest(); + return this; + } + + public VirtualHardDisk apply() { + this.innerObject = serviceManager.serviceClient() + .getVirtualHardDisks() + .update(resourceGroupName, virtualHardDiskName, updateProperties, Context.NONE); + return this; + } + + public VirtualHardDisk apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVirtualHardDisks() + .update(resourceGroupName, virtualHardDiskName, updateProperties, context); + return this; + } + + VirtualHardDiskImpl(VirtualHardDiskInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.virtualHardDiskName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "virtualHardDisks"); + } + + public VirtualHardDisk refresh() { + this.innerObject = serviceManager.serviceClient() + .getVirtualHardDisks() + .getByResourceGroupWithResponse(resourceGroupName, virtualHardDiskName, Context.NONE) + .getValue(); + return this; + } + + public VirtualHardDisk refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getVirtualHardDisks() + .getByResourceGroupWithResponse(resourceGroupName, virtualHardDiskName, context) + .getValue(); + return this; + } + + public VirtualHardDiskUploadResponse upload(VirtualHardDiskUploadRequest body) { + return serviceManager.virtualHardDisks().upload(resourceGroupName, virtualHardDiskName, body); + } + + public VirtualHardDiskUploadResponse upload(VirtualHardDiskUploadRequest body, Context context) { + return serviceManager.virtualHardDisks().upload(resourceGroupName, virtualHardDiskName, body, context); + } + + public VirtualHardDiskImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public VirtualHardDiskImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public VirtualHardDiskImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public VirtualHardDiskImpl withProperties(VirtualHardDiskProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public VirtualHardDiskImpl withExtendedLocation(ExtendedLocation extendedLocation) { + this.innerModel().withExtendedLocation(extendedLocation); + return this; + } + + public VirtualHardDiskImpl withProperties(VirtualHardDisksUpdateProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDiskUploadResponseImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDiskUploadResponseImpl.java new file mode 100644 index 000000000000..f034645300f0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDiskUploadResponseImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskUploadResponseInner; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadResponse; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadStatus; + +public final class VirtualHardDiskUploadResponseImpl implements VirtualHardDiskUploadResponse { + private VirtualHardDiskUploadResponseInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + VirtualHardDiskUploadResponseImpl(VirtualHardDiskUploadResponseInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String virtualHardDiskId() { + return this.innerModel().virtualHardDiskId(); + } + + public VirtualHardDiskUploadStatus uploadStatus() { + return this.innerModel().uploadStatus(); + } + + public VirtualHardDiskUploadResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDisksClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDisksClientImpl.java new file mode 100644 index 000000000000..f698c9967163 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDisksClientImpl.java @@ -0,0 +1,1743 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskInner; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskUploadResponseInner; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.VirtualHardDiskListResult; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadRequest; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisksUpdateRequest; +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 VirtualHardDisksClient. + */ +public final class VirtualHardDisksClientImpl implements VirtualHardDisksClient { + /** + * The proxy service used to perform REST calls. + */ + private final VirtualHardDisksService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of VirtualHardDisksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualHardDisksClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service + = RestProxy.create(VirtualHardDisksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientVirtualHardDisks to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientVirtualHardDisks") + public interface VirtualHardDisksService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualHardDiskName") String virtualHardDiskName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualHardDiskName") String virtualHardDiskName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualHardDiskName") String virtualHardDiskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualHardDiskInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualHardDiskName") String virtualHardDiskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualHardDiskInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualHardDiskName") String virtualHardDiskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualHardDisksUpdateRequest properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualHardDiskName") String virtualHardDiskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualHardDisksUpdateRequest properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualHardDiskName") String virtualHardDiskName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualHardDiskName") String virtualHardDiskName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualHardDisks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.AzureStackHCI/virtualHardDisks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}/upload") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> upload(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualHardDiskName") String virtualHardDiskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualHardDiskUploadRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureStackHCI/virtualHardDisks/{virtualHardDiskName}/upload") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response uploadSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("virtualHardDiskName") String virtualHardDiskName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualHardDiskUploadRequest body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAllNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual hard disk along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String virtualHardDiskName) { + 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 (virtualHardDiskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualHardDiskName 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, virtualHardDiskName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual hard disk on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String virtualHardDiskName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, virtualHardDiskName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual hard disk along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String virtualHardDiskName, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualHardDiskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter virtualHardDiskName is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, accept, context); + } + + /** + * Gets a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtual hard disk. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualHardDiskInner getByResourceGroup(String resourceGroupName, String virtualHardDiskName) { + return getByResourceGroupWithResponse(resourceGroupName, virtualHardDiskName, Context.NONE).getValue(); + } + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String virtualHardDiskName, VirtualHardDiskInner 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 (virtualHardDiskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualHardDiskName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskInner resource) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualHardDiskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter virtualHardDiskName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, contentType, accept, resource, + Context.NONE); + } + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskInner resource, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualHardDiskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter virtualHardDiskName is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, contentType, accept, resource, + context); + } + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 the virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualHardDiskInner> + beginCreateOrUpdateAsync(String resourceGroupName, String virtualHardDiskName, VirtualHardDiskInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, virtualHardDiskName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + VirtualHardDiskInner.class, VirtualHardDiskInner.class, this.client.getContext()); + } + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 the virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualHardDiskInner> + beginCreateOrUpdate(String resourceGroupName, String virtualHardDiskName, VirtualHardDiskInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, virtualHardDiskName, resource); + return this.client.getLroResult(response, + VirtualHardDiskInner.class, VirtualHardDiskInner.class, Context.NONE); + } + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 the virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualHardDiskInner> beginCreateOrUpdate( + String resourceGroupName, String virtualHardDiskName, VirtualHardDiskInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, virtualHardDiskName, resource, context); + return this.client.getLroResult(response, + VirtualHardDiskInner.class, VirtualHardDiskInner.class, context); + } + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, virtualHardDiskName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualHardDiskInner createOrUpdate(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskInner resource) { + return beginCreateOrUpdate(resourceGroupName, virtualHardDiskName, resource).getFinalResult(); + } + + /** + * The operation to create or update a virtual hard disk. Please note some properties can be set only during virtual + * hard disk creation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualHardDiskInner createOrUpdate(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, virtualHardDiskName, resource, context).getFinalResult(); + } + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String virtualHardDiskName, VirtualHardDisksUpdateRequest 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 (virtualHardDiskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualHardDiskName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String virtualHardDiskName, + VirtualHardDisksUpdateRequest properties) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualHardDiskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter virtualHardDiskName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, contentType, accept, properties, + Context.NONE); + } + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String virtualHardDiskName, + VirtualHardDisksUpdateRequest properties, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualHardDiskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter virtualHardDiskName is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, contentType, accept, properties, + context); + } + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 the virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualHardDiskInner> beginUpdateAsync( + String resourceGroupName, String virtualHardDiskName, VirtualHardDisksUpdateRequest properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, virtualHardDiskName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + VirtualHardDiskInner.class, VirtualHardDiskInner.class, this.client.getContext()); + } + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 the virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualHardDiskInner> beginUpdate(String resourceGroupName, + String virtualHardDiskName, VirtualHardDisksUpdateRequest properties) { + Response response = updateWithResponse(resourceGroupName, virtualHardDiskName, properties); + return this.client.getLroResult(response, + VirtualHardDiskInner.class, VirtualHardDiskInner.class, Context.NONE); + } + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 the virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualHardDiskInner> beginUpdate(String resourceGroupName, + String virtualHardDiskName, VirtualHardDisksUpdateRequest properties, Context context) { + Response response = updateWithResponse(resourceGroupName, virtualHardDiskName, properties, context); + return this.client.getLroResult(response, + VirtualHardDiskInner.class, VirtualHardDiskInner.class, context); + } + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String virtualHardDiskName, + VirtualHardDisksUpdateRequest properties) { + return beginUpdateAsync(resourceGroupName, virtualHardDiskName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualHardDiskInner update(String resourceGroupName, String virtualHardDiskName, + VirtualHardDisksUpdateRequest properties) { + return beginUpdate(resourceGroupName, virtualHardDiskName, properties).getFinalResult(); + } + + /** + * The operation to update a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @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 virtual hard disk resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualHardDiskInner update(String resourceGroupName, String virtualHardDiskName, + VirtualHardDisksUpdateRequest properties, Context context) { + return beginUpdate(resourceGroupName, virtualHardDiskName, properties, context).getFinalResult(); + } + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 virtualHardDiskName) { + 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 (virtualHardDiskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualHardDiskName is required and cannot be null.")); + } + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String virtualHardDiskName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualHardDiskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter virtualHardDiskName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, Context.NONE); + } + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String virtualHardDiskName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualHardDiskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter virtualHardDiskName is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, context); + } + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 virtualHardDiskName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, virtualHardDiskName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 virtualHardDiskName) { + Response response = deleteWithResponse(resourceGroupName, virtualHardDiskName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is 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 virtualHardDiskName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, virtualHardDiskName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 virtualHardDiskName) { + return beginDeleteAsync(resourceGroupName, virtualHardDiskName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualHardDiskName) { + beginDelete(resourceGroupName, virtualHardDiskName).getFinalResult(); + } + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 virtualHardDiskName, Context context) { + beginDelete(resourceGroupName, virtualHardDiskName, context).getFinalResult(); + } + + /** + * Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @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 VirtualHardDisk 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())); + } + + /** + * Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @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 VirtualHardDisk 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)); + } + + /** + * Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @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 VirtualHardDisk list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @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 VirtualHardDisk list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @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 VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @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 VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk 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())); + } + + /** + * Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listAllNextSinglePage(nextLink)); + } + + /** + * Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listAllNextSinglePage(nextLink, context)); + } + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> uploadWithResponseAsync(String resourceGroupName, + String virtualHardDiskName, VirtualHardDiskUploadRequest 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 (virtualHardDiskName == null) { + return Mono + .error(new IllegalArgumentException("Parameter virtualHardDiskName 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 contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.upload(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, contentType, accept, body, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response uploadWithResponse(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskUploadRequest body) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualHardDiskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter virtualHardDiskName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.uploadSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, contentType, accept, body, + Context.NONE); + } + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response uploadWithResponse(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskUploadRequest body, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (virtualHardDiskName == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter virtualHardDiskName is required and cannot be null.")); + } + if (body == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.uploadSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, virtualHardDiskName, contentType, accept, body, + context); + } + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualHardDiskUploadResponseInner> + beginUploadAsync(String resourceGroupName, String virtualHardDiskName, VirtualHardDiskUploadRequest body) { + Mono>> mono = uploadWithResponseAsync(resourceGroupName, virtualHardDiskName, body); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), VirtualHardDiskUploadResponseInner.class, + VirtualHardDiskUploadResponseInner.class, this.client.getContext()); + } + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualHardDiskUploadResponseInner> + beginUpload(String resourceGroupName, String virtualHardDiskName, VirtualHardDiskUploadRequest body) { + Response response = uploadWithResponse(resourceGroupName, virtualHardDiskName, body); + return this.client.getLroResult( + response, VirtualHardDiskUploadResponseInner.class, VirtualHardDiskUploadResponseInner.class, Context.NONE); + } + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualHardDiskUploadResponseInner> beginUpload( + String resourceGroupName, String virtualHardDiskName, VirtualHardDiskUploadRequest body, Context context) { + Response response = uploadWithResponse(resourceGroupName, virtualHardDiskName, body, context); + return this.client.getLroResult( + response, VirtualHardDiskUploadResponseInner.class, VirtualHardDiskUploadResponseInner.class, context); + } + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono uploadAsync(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskUploadRequest body) { + return beginUploadAsync(resourceGroupName, virtualHardDiskName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualHardDiskUploadResponseInner upload(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskUploadRequest body) { + return beginUpload(resourceGroupName, virtualHardDiskName, body).getFinalResult(); + } + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualHardDiskUploadResponseInner upload(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskUploadRequest body, Context context) { + return beginUpload(resourceGroupName, virtualHardDiskName, body, context).getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listAllNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listAllNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualHardDisksClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDisksImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDisksImpl.java new file mode 100644 index 000000000000..7f54ab759a4b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualHardDisksImpl.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.VirtualHardDisksClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskInner; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskUploadResponseInner; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisk; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadRequest; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadResponse; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisks; + +public final class VirtualHardDisksImpl implements VirtualHardDisks { + private static final ClientLogger LOGGER = new ClientLogger(VirtualHardDisksImpl.class); + + private final VirtualHardDisksClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public VirtualHardDisksImpl(VirtualHardDisksClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String virtualHardDiskName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, virtualHardDiskName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new VirtualHardDiskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualHardDisk getByResourceGroup(String resourceGroupName, String virtualHardDiskName) { + VirtualHardDiskInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, virtualHardDiskName); + if (inner != null) { + return new VirtualHardDiskImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String virtualHardDiskName) { + this.serviceClient().delete(resourceGroupName, virtualHardDiskName); + } + + public void delete(String resourceGroupName, String virtualHardDiskName, Context context) { + this.serviceClient().delete(resourceGroupName, virtualHardDiskName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VirtualHardDiskImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VirtualHardDiskImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VirtualHardDiskImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VirtualHardDiskImpl(inner1, this.manager())); + } + + public VirtualHardDiskUploadResponse upload(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskUploadRequest body) { + VirtualHardDiskUploadResponseInner inner + = this.serviceClient().upload(resourceGroupName, virtualHardDiskName, body); + if (inner != null) { + return new VirtualHardDiskUploadResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualHardDiskUploadResponse upload(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskUploadRequest body, Context context) { + VirtualHardDiskUploadResponseInner inner + = this.serviceClient().upload(resourceGroupName, virtualHardDiskName, body, context); + if (inner != null) { + return new VirtualHardDiskUploadResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualHardDisk 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 virtualHardDiskName = ResourceManagerUtils.getValueFromIdByName(id, "virtualHardDisks"); + if (virtualHardDiskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualHardDisks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, virtualHardDiskName, 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 virtualHardDiskName = ResourceManagerUtils.getValueFromIdByName(id, "virtualHardDisks"); + if (virtualHardDiskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualHardDisks'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, virtualHardDiskName, 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 virtualHardDiskName = ResourceManagerUtils.getValueFromIdByName(id, "virtualHardDisks"); + if (virtualHardDiskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualHardDisks'.", id))); + } + this.delete(resourceGroupName, virtualHardDiskName, 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 virtualHardDiskName = ResourceManagerUtils.getValueFromIdByName(id, "virtualHardDisks"); + if (virtualHardDiskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'virtualHardDisks'.", id))); + } + this.delete(resourceGroupName, virtualHardDiskName, context); + } + + private VirtualHardDisksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } + + public VirtualHardDiskImpl define(String name) { + return new VirtualHardDiskImpl(name, this.manager()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualMachineInstanceImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualMachineInstanceImpl.java new file mode 100644 index 000000000000..bf6814220cf8 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualMachineInstanceImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ManagedServiceIdentity; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstance; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceProperties; + +public final class VirtualMachineInstanceImpl implements VirtualMachineInstance { + private VirtualMachineInstanceInner innerObject; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + VirtualMachineInstanceImpl(VirtualMachineInstanceInner innerObject, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public VirtualMachineInstanceProperties properties() { + return this.innerModel().properties(); + } + + public ExtendedLocation extendedLocation() { + return this.innerModel().extendedLocation(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public VirtualMachineInstanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualMachineInstancesClientImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualMachineInstancesClientImpl.java new file mode 100644 index 000000000000..a7b35b5902ba --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualMachineInstancesClientImpl.java @@ -0,0 +1,1925 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.VirtualMachineInstanceListResult; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateRequest; +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 VirtualMachineInstancesClient. + */ +public final class VirtualMachineInstancesClientImpl implements VirtualMachineInstancesClient { + /** + * The proxy service used to perform REST calls. + */ + private final VirtualMachineInstancesService service; + + /** + * The service client containing this operation class. + */ + private final AzureStackHciVmMgmtClientImpl client; + + /** + * Initializes an instance of VirtualMachineInstancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineInstancesClientImpl(AzureStackHciVmMgmtClientImpl client) { + this.service = RestProxy.create(VirtualMachineInstancesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureStackHciVmMgmtClientVirtualMachineInstances to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "AzureStackHciVmMgmtClientVirtualMachineInstances") + public interface VirtualMachineInstancesService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Put("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualMachineInstanceInner resource, Context context); + + @Put("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualMachineInstanceInner resource, Context context); + + @Patch("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualMachineInstanceUpdateRequest properties, Context context); + + @Patch("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") VirtualMachineInstanceUpdateRequest properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/start") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response startSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> stop(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/stop") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response stopSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restart(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/restart") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response restartSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/pause") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> pause(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/pause") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response pauseSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/save") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> save(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/{resourceUri}/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default/save") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response saveSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets a virtual machine instance. + * + * @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 a virtual machine instance along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(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.get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a virtual machine instance. + * + * @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 a virtual machine instance on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri) { + return getWithResponseAsync(resourceUri).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a virtual machine instance. + * + * @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 a virtual machine instance along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, accept, context); + } + + /** + * Gets a virtual machine instance. + * + * @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 a virtual machine instance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInstanceInner get(String resourceUri) { + return getWithResponse(resourceUri, Context.NONE).getValue(); + } + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceUri, + VirtualMachineInstanceInner 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 (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, VirtualMachineInstanceInner resource) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + contentType, accept, resource, Context.NONE); + } + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceUri, VirtualMachineInstanceInner resource, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (resource == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + contentType, accept, resource, context); + } + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 the virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInstanceInner> + beginCreateOrUpdateAsync(String resourceUri, VirtualMachineInstanceInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceUri, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), VirtualMachineInstanceInner.class, VirtualMachineInstanceInner.class, + this.client.getContext()); + } + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 the virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInstanceInner> + beginCreateOrUpdate(String resourceUri, VirtualMachineInstanceInner resource) { + Response response = createOrUpdateWithResponse(resourceUri, resource); + return this.client.getLroResult(response, + VirtualMachineInstanceInner.class, VirtualMachineInstanceInner.class, Context.NONE); + } + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 the virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInstanceInner> + beginCreateOrUpdate(String resourceUri, VirtualMachineInstanceInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceUri, resource, context); + return this.client.getLroResult(response, + VirtualMachineInstanceInner.class, VirtualMachineInstanceInner.class, context); + } + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceUri, + VirtualMachineInstanceInner resource) { + return beginCreateOrUpdateAsync(resourceUri, resource).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInstanceInner createOrUpdate(String resourceUri, VirtualMachineInstanceInner resource) { + return beginCreateOrUpdate(resourceUri, resource).getFinalResult(); + } + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInstanceInner createOrUpdate(String resourceUri, VirtualMachineInstanceInner resource, + Context context) { + return beginCreateOrUpdate(resourceUri, resource, context).getFinalResult(); + } + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceUri, + VirtualMachineInstanceUpdateRequest 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 (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceUri, + VirtualMachineInstanceUpdateRequest properties) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, contentType, + accept, properties, Context.NONE); + } + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceUri, VirtualMachineInstanceUpdateRequest properties, + Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (properties == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, contentType, + accept, properties, context); + } + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 the virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, VirtualMachineInstanceInner> + beginUpdateAsync(String resourceUri, VirtualMachineInstanceUpdateRequest properties) { + Mono>> mono = updateWithResponseAsync(resourceUri, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), VirtualMachineInstanceInner.class, VirtualMachineInstanceInner.class, + this.client.getContext()); + } + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 the virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInstanceInner> + beginUpdate(String resourceUri, VirtualMachineInstanceUpdateRequest properties) { + Response response = updateWithResponse(resourceUri, properties); + return this.client.getLroResult(response, + VirtualMachineInstanceInner.class, VirtualMachineInstanceInner.class, Context.NONE); + } + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 the virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, VirtualMachineInstanceInner> + beginUpdate(String resourceUri, VirtualMachineInstanceUpdateRequest properties, Context context) { + Response response = updateWithResponse(resourceUri, properties, context); + return this.client.getLroResult(response, + VirtualMachineInstanceInner.class, VirtualMachineInstanceInner.class, context); + } + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceUri, + VirtualMachineInstanceUpdateRequest properties) { + return beginUpdateAsync(resourceUri, properties).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInstanceInner update(String resourceUri, VirtualMachineInstanceUpdateRequest properties) { + return beginUpdate(resourceUri, properties).getFinalResult(); + } + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualMachineInstanceInner update(String resourceUri, VirtualMachineInstanceUpdateRequest properties, + Context context) { + return beginUpdate(resourceUri, properties, context).getFinalResult(); + } + + /** + * The operation to delete a virtual machine instance. + * + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(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.")); + } + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to delete a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, Context.NONE); + } + + /** + * The operation to delete a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context); + } + + /** + * The operation to delete a virtual machine instance. + * + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceUri) { + Mono>> mono = deleteWithResponseAsync(resourceUri); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to delete a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri) { + Response response = deleteWithResponse(resourceUri); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to delete a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceUri, Context context) { + Response response = deleteWithResponse(resourceUri, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to delete a virtual machine instance. + * + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceUri) { + return beginDeleteAsync(resourceUri).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri) { + beginDelete(resourceUri).getFinalResult(); + } + + /** + * The operation to delete a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, Context context) { + beginDelete(resourceUri, context).getFinalResult(); + } + + /** + * Lists all of the virtual machine instances within the specified parent resource. + * + * @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 VirtualMachineInstance list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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.list(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())); + } + + /** + * Lists all of the virtual machine instances within the specified parent resource. + * + * @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 VirtualMachineInstance list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the virtual machine instances within the specified parent resource. + * + * @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 VirtualMachineInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceUri) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), resourceUri, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the virtual machine instances within the specified parent resource. + * + * @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 VirtualMachineInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all of the virtual machine instances within the specified parent resource. + * + * @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 VirtualMachineInstance list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + return new PagedIterable<>(() -> listSinglePage(resourceUri), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Lists all of the virtual machine instances within the specified parent resource. + * + * @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 VirtualMachineInstance list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri, Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceUri, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * The operation to start a virtual machine instance. + * + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync(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.")); + } + return FluxUtil + .withContext( + context -> service.start(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to start a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response startWithResponse(String resourceUri) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.startSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, Context.NONE); + } + + /** + * The operation to start a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response startWithResponse(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.startSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context); + } + + /** + * The operation to start a virtual machine instance. + * + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStartAsync(String resourceUri) { + Mono>> mono = startWithResponseAsync(resourceUri); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to start a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceUri) { + Response response = startWithResponse(resourceUri); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to start a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStart(String resourceUri, Context context) { + Response response = startWithResponse(resourceUri, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to start a virtual machine instance. + * + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceUri) { + return beginStartAsync(resourceUri).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to start a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceUri) { + beginStart(resourceUri).getFinalResult(); + } + + /** + * The operation to start a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceUri, Context context) { + beginStart(resourceUri, context).getFinalResult(); + } + + /** + * The operation to stop a virtual machine instance. + * + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> stopWithResponseAsync(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.")); + } + return FluxUtil + .withContext( + context -> service.stop(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to stop a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response stopWithResponse(String resourceUri) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.stopSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, Context.NONE); + } + + /** + * The operation to stop a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response stopWithResponse(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.stopSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context); + } + + /** + * The operation to stop a virtual machine instance. + * + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginStopAsync(String resourceUri) { + Mono>> mono = stopWithResponseAsync(resourceUri); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to stop a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStop(String resourceUri) { + Response response = stopWithResponse(resourceUri); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to stop a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginStop(String resourceUri, Context context) { + Response response = stopWithResponse(resourceUri, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to stop a virtual machine instance. + * + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceUri) { + return beginStopAsync(resourceUri).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to stop a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop(String resourceUri) { + beginStop(resourceUri).getFinalResult(); + } + + /** + * The operation to stop a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop(String resourceUri, Context context) { + beginStop(resourceUri, context).getFinalResult(); + } + + /** + * The operation to restart a virtual machine instance. + * + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync(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.")); + } + return FluxUtil.withContext( + context -> service.restart(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to restart a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response restartWithResponse(String resourceUri) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.restartSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, Context.NONE); + } + + /** + * The operation to restart a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response restartWithResponse(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.restartSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context); + } + + /** + * The operation to restart a virtual machine instance. + * + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginRestartAsync(String resourceUri) { + Mono>> mono = restartWithResponseAsync(resourceUri); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to restart a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart(String resourceUri) { + Response response = restartWithResponse(resourceUri); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to restart a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginRestart(String resourceUri, Context context) { + Response response = restartWithResponse(resourceUri, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to restart a virtual machine instance. + * + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceUri) { + return beginRestartAsync(resourceUri).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to restart a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceUri) { + beginRestart(resourceUri).getFinalResult(); + } + + /** + * The operation to restart a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceUri, Context context) { + beginRestart(resourceUri, context).getFinalResult(); + } + + /** + * The operation to pause a virtual machine instance. + * + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> pauseWithResponseAsync(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.")); + } + return FluxUtil + .withContext( + context -> service.pause(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to pause a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response pauseWithResponse(String resourceUri) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.pauseSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, Context.NONE); + } + + /** + * The operation to pause a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response pauseWithResponse(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.pauseSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context); + } + + /** + * The operation to pause a virtual machine instance. + * + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginPauseAsync(String resourceUri) { + Mono>> mono = pauseWithResponseAsync(resourceUri); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to pause a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPause(String resourceUri) { + Response response = pauseWithResponse(resourceUri); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to pause a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginPause(String resourceUri, Context context) { + Response response = pauseWithResponse(resourceUri, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to pause a virtual machine instance. + * + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono pauseAsync(String resourceUri) { + return beginPauseAsync(resourceUri).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to pause a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void pause(String resourceUri) { + beginPause(resourceUri).getFinalResult(); + } + + /** + * The operation to pause a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void pause(String resourceUri, Context context) { + beginPause(resourceUri, context).getFinalResult(); + } + + /** + * The operation to save a virtual machine instance. + * + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> saveWithResponseAsync(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.")); + } + return FluxUtil + .withContext( + context -> service.save(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * The operation to save a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response saveWithResponse(String resourceUri) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.saveSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, Context.NONE); + } + + /** + * The operation to save a virtual machine instance. + * + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response saveWithResponse(String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + return service.saveSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, context); + } + + /** + * The operation to save a virtual machine instance. + * + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginSaveAsync(String resourceUri) { + Mono>> mono = saveWithResponseAsync(resourceUri); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * The operation to save a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginSave(String resourceUri) { + Response response = saveWithResponse(resourceUri); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * The operation to save a virtual machine instance. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginSave(String resourceUri, Context context) { + Response response = saveWithResponse(resourceUri, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * The operation to save a virtual machine instance. + * + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono saveAsync(String resourceUri) { + return beginSaveAsync(resourceUri).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to save a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void save(String resourceUri) { + beginSave(resourceUri).getFinalResult(); + } + + /** + * The operation to save a virtual machine instance. + * + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void save(String resourceUri, Context context) { + beginSave(resourceUri, context).getFinalResult(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualMachineInstance list operation 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualMachineInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualMachineInstance list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + if (nextLink == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineInstancesClientImpl.class); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualMachineInstancesImpl.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualMachineInstancesImpl.java new file mode 100644 index 000000000000..0e379ffba310 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/VirtualMachineInstancesImpl.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.VirtualMachineInstancesClient; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstance; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateRequest; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstances; + +public final class VirtualMachineInstancesImpl implements VirtualMachineInstances { + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineInstancesImpl.class); + + private final VirtualMachineInstancesClient innerClient; + + private final com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager; + + public VirtualMachineInstancesImpl(VirtualMachineInstancesClient innerClient, + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceUri, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceUri, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new VirtualMachineInstanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VirtualMachineInstance get(String resourceUri) { + VirtualMachineInstanceInner inner = this.serviceClient().get(resourceUri); + if (inner != null) { + return new VirtualMachineInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineInstance createOrUpdate(String resourceUri, VirtualMachineInstanceInner resource) { + VirtualMachineInstanceInner inner = this.serviceClient().createOrUpdate(resourceUri, resource); + if (inner != null) { + return new VirtualMachineInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineInstance createOrUpdate(String resourceUri, VirtualMachineInstanceInner resource, + Context context) { + VirtualMachineInstanceInner inner = this.serviceClient().createOrUpdate(resourceUri, resource, context); + if (inner != null) { + return new VirtualMachineInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineInstance update(String resourceUri, VirtualMachineInstanceUpdateRequest properties) { + VirtualMachineInstanceInner inner = this.serviceClient().update(resourceUri, properties); + if (inner != null) { + return new VirtualMachineInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public VirtualMachineInstance update(String resourceUri, VirtualMachineInstanceUpdateRequest properties, + Context context) { + VirtualMachineInstanceInner inner = this.serviceClient().update(resourceUri, properties, context); + if (inner != null) { + return new VirtualMachineInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceUri) { + this.serviceClient().delete(resourceUri); + } + + public void delete(String resourceUri, Context context) { + this.serviceClient().delete(resourceUri, context); + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VirtualMachineInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VirtualMachineInstanceImpl(inner1, this.manager())); + } + + public void start(String resourceUri) { + this.serviceClient().start(resourceUri); + } + + public void start(String resourceUri, Context context) { + this.serviceClient().start(resourceUri, context); + } + + public void stop(String resourceUri) { + this.serviceClient().stop(resourceUri); + } + + public void stop(String resourceUri, Context context) { + this.serviceClient().stop(resourceUri, context); + } + + public void restart(String resourceUri) { + this.serviceClient().restart(resourceUri); + } + + public void restart(String resourceUri, Context context) { + this.serviceClient().restart(resourceUri, context); + } + + public void pause(String resourceUri) { + this.serviceClient().pause(resourceUri); + } + + public void pause(String resourceUri, Context context) { + this.serviceClient().pause(resourceUri, context); + } + + public void save(String resourceUri) { + this.serviceClient().save(resourceUri); + } + + public void save(String resourceUri, Context context) { + this.serviceClient().save(resourceUri, context); + } + + private VirtualMachineInstancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/GalleryImageListResult.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/GalleryImageListResult.java new file mode 100644 index 000000000000..35299dba89bb --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/GalleryImageListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.fluent.models.GalleryImageInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a GalleryImage list operation. + */ +@Immutable +public final class GalleryImageListResult implements JsonSerializable { + /* + * The GalleryImage items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of GalleryImageListResult class. + */ + private GalleryImageListResult() { + } + + /** + * Get the value property: The GalleryImage items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 GalleryImageListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GalleryImageListResult.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 GalleryImageListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryImageListResult 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 GalleryImageListResult. + */ + public static GalleryImageListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryImageListResult deserializedGalleryImageListResult = new GalleryImageListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> GalleryImageInner.fromJson(reader1)); + deserializedGalleryImageListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedGalleryImageListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryImageListResult; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/GuestAgentListResult.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/GuestAgentListResult.java new file mode 100644 index 000000000000..e89452b37445 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/GuestAgentListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.fluent.models.GuestAgentInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a GuestAgent list operation. + */ +@Immutable +public final class GuestAgentListResult implements JsonSerializable { + /* + * The GuestAgent items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of GuestAgentListResult class. + */ + private GuestAgentListResult() { + } + + /** + * Get the value property: The GuestAgent items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 GuestAgentListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GuestAgentListResult.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 GuestAgentListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GuestAgentListResult 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 GuestAgentListResult. + */ + public static GuestAgentListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GuestAgentListResult deserializedGuestAgentListResult = new GuestAgentListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> GuestAgentInner.fromJson(reader1)); + deserializedGuestAgentListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedGuestAgentListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGuestAgentListResult; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/HybridIdentityMetadataListResult.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/HybridIdentityMetadataListResult.java new file mode 100644 index 000000000000..24274784192f --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/HybridIdentityMetadataListResult.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.fluent.models.HybridIdentityMetadataInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a HybridIdentityMetadata list operation. + */ +@Immutable +public final class HybridIdentityMetadataListResult implements JsonSerializable { + /* + * The HybridIdentityMetadata items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of HybridIdentityMetadataListResult class. + */ + private HybridIdentityMetadataListResult() { + } + + /** + * Get the value property: The HybridIdentityMetadata items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 HybridIdentityMetadataListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HybridIdentityMetadataListResult.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 HybridIdentityMetadataListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HybridIdentityMetadataListResult 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 HybridIdentityMetadataListResult. + */ + public static HybridIdentityMetadataListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HybridIdentityMetadataListResult deserializedHybridIdentityMetadataListResult + = new HybridIdentityMetadataListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> HybridIdentityMetadataInner.fromJson(reader1)); + deserializedHybridIdentityMetadataListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedHybridIdentityMetadataListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedHybridIdentityMetadataListResult; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/LogicalNetworkListResult.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/LogicalNetworkListResult.java new file mode 100644 index 000000000000..713fceb30a74 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/LogicalNetworkListResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.fluent.models.LogicalNetworkInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a LogicalNetwork list operation. + */ +@Immutable +public final class LogicalNetworkListResult implements JsonSerializable { + /* + * The LogicalNetwork items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of LogicalNetworkListResult class. + */ + private LogicalNetworkListResult() { + } + + /** + * Get the value property: The LogicalNetwork items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 LogicalNetworkListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LogicalNetworkListResult.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 LogicalNetworkListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogicalNetworkListResult 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 LogicalNetworkListResult. + */ + public static LogicalNetworkListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogicalNetworkListResult deserializedLogicalNetworkListResult = new LogicalNetworkListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> LogicalNetworkInner.fromJson(reader1)); + deserializedLogicalNetworkListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedLogicalNetworkListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLogicalNetworkListResult; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/MarketplaceGalleryImageListResult.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/MarketplaceGalleryImageListResult.java new file mode 100644 index 000000000000..3f74a3f56537 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/MarketplaceGalleryImageListResult.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.fluent.models.MarketplaceGalleryImageInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a MarketplaceGalleryImage list operation. + */ +@Immutable +public final class MarketplaceGalleryImageListResult implements JsonSerializable { + /* + * The MarketplaceGalleryImage items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of MarketplaceGalleryImageListResult class. + */ + private MarketplaceGalleryImageListResult() { + } + + /** + * Get the value property: The MarketplaceGalleryImage items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 MarketplaceGalleryImageListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MarketplaceGalleryImageListResult.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 MarketplaceGalleryImageListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceGalleryImageListResult 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 MarketplaceGalleryImageListResult. + */ + public static MarketplaceGalleryImageListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceGalleryImageListResult deserializedMarketplaceGalleryImageListResult + = new MarketplaceGalleryImageListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MarketplaceGalleryImageInner.fromJson(reader1)); + deserializedMarketplaceGalleryImageListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedMarketplaceGalleryImageListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceGalleryImageListResult; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/NetworkInterfaceListResult.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/NetworkInterfaceListResult.java new file mode 100644 index 000000000000..77de7b06b180 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/NetworkInterfaceListResult.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.fluent.models.NetworkInterfaceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a NetworkInterface list operation. + */ +@Immutable +public final class NetworkInterfaceListResult implements JsonSerializable { + /* + * The NetworkInterface items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of NetworkInterfaceListResult class. + */ + private NetworkInterfaceListResult() { + } + + /** + * Get the value property: The NetworkInterface items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 NetworkInterfaceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NetworkInterfaceListResult.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 NetworkInterfaceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkInterfaceListResult 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 NetworkInterfaceListResult. + */ + public static NetworkInterfaceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkInterfaceListResult deserializedNetworkInterfaceListResult = new NetworkInterfaceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> NetworkInterfaceInner.fromJson(reader1)); + deserializedNetworkInterfaceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedNetworkInterfaceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkInterfaceListResult; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/NetworkSecurityGroupListResult.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/NetworkSecurityGroupListResult.java new file mode 100644 index 000000000000..71cbdb5bfc79 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/NetworkSecurityGroupListResult.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.fluent.models.NetworkSecurityGroupInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a NetworkSecurityGroup list operation. + */ +@Immutable +public final class NetworkSecurityGroupListResult implements JsonSerializable { + /* + * The NetworkSecurityGroup items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of NetworkSecurityGroupListResult class. + */ + private NetworkSecurityGroupListResult() { + } + + /** + * Get the value property: The NetworkSecurityGroup items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 NetworkSecurityGroupListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NetworkSecurityGroupListResult.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 NetworkSecurityGroupListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkSecurityGroupListResult 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 NetworkSecurityGroupListResult. + */ + public static NetworkSecurityGroupListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkSecurityGroupListResult deserializedNetworkSecurityGroupListResult + = new NetworkSecurityGroupListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> NetworkSecurityGroupInner.fromJson(reader1)); + deserializedNetworkSecurityGroupListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedNetworkSecurityGroupListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkSecurityGroupListResult; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/SecurityRuleListResult.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/SecurityRuleListResult.java new file mode 100644 index 000000000000..fa39f9a370fc --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/SecurityRuleListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.fluent.models.SecurityRuleInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a SecurityRule list operation. + */ +@Immutable +public final class SecurityRuleListResult implements JsonSerializable { + /* + * The SecurityRule items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of SecurityRuleListResult class. + */ + private SecurityRuleListResult() { + } + + /** + * Get the value property: The SecurityRule items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 SecurityRuleListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityRuleListResult.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 SecurityRuleListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityRuleListResult 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 SecurityRuleListResult. + */ + public static SecurityRuleListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityRuleListResult deserializedSecurityRuleListResult = new SecurityRuleListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> SecurityRuleInner.fromJson(reader1)); + deserializedSecurityRuleListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSecurityRuleListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityRuleListResult; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/StorageContainerListResult.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/StorageContainerListResult.java new file mode 100644 index 000000000000..818b793dae39 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/StorageContainerListResult.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.fluent.models.StorageContainerInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a StorageContainer list operation. + */ +@Immutable +public final class StorageContainerListResult implements JsonSerializable { + /* + * The StorageContainer items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of StorageContainerListResult class. + */ + private StorageContainerListResult() { + } + + /** + * Get the value property: The StorageContainer items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 StorageContainerListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageContainerListResult.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 StorageContainerListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageContainerListResult 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 StorageContainerListResult. + */ + public static StorageContainerListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageContainerListResult deserializedStorageContainerListResult = new StorageContainerListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> StorageContainerInner.fromJson(reader1)); + deserializedStorageContainerListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedStorageContainerListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageContainerListResult; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/VirtualHardDiskListResult.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/VirtualHardDiskListResult.java new file mode 100644 index 000000000000..ba028ac22ba1 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/VirtualHardDiskListResult.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.fluent.models.VirtualHardDiskInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a VirtualHardDisk list operation. + */ +@Immutable +public final class VirtualHardDiskListResult implements JsonSerializable { + /* + * The VirtualHardDisk items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of VirtualHardDiskListResult class. + */ + private VirtualHardDiskListResult() { + } + + /** + * Get the value property: The VirtualHardDisk items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 VirtualHardDiskListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualHardDiskListResult.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 VirtualHardDiskListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDiskListResult 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 VirtualHardDiskListResult. + */ + public static VirtualHardDiskListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDiskListResult deserializedVirtualHardDiskListResult = new VirtualHardDiskListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> VirtualHardDiskInner.fromJson(reader1)); + deserializedVirtualHardDiskListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedVirtualHardDiskListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDiskListResult; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/VirtualMachineInstanceListResult.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/VirtualMachineInstanceListResult.java new file mode 100644 index 000000000000..8f0b5201cce4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/models/VirtualMachineInstanceListResult.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.implementation.models; + +import com.azure.core.annotation.Immutable; +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.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a VirtualMachineInstance list operation. + */ +@Immutable +public final class VirtualMachineInstanceListResult implements JsonSerializable { + /* + * The VirtualMachineInstance items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of VirtualMachineInstanceListResult class. + */ + private VirtualMachineInstanceListResult() { + } + + /** + * Get the value property: The VirtualMachineInstance items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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 VirtualMachineInstanceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualMachineInstanceListResult.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 VirtualMachineInstanceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstanceListResult 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 VirtualMachineInstanceListResult. + */ + public static VirtualMachineInstanceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstanceListResult deserializedVirtualMachineInstanceListResult + = new VirtualMachineInstanceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> VirtualMachineInstanceInner.fromJson(reader1)); + deserializedVirtualMachineInstanceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedVirtualMachineInstanceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstanceListResult; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/package-info.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/package-info.java new file mode 100644 index 000000000000..116b151926d2 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for AzureStackHciVm. + * Azure Stack HCI management service. + */ +package com.azure.resourcemanager.azurestackhci.vm.implementation; diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestBootIntegrityPropertyEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestBootIntegrityPropertyEnum.java new file mode 100644 index 000000000000..85aa8a98308c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestBootIntegrityPropertyEnum.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of whether the list of boot integrity properties is validated. + */ +public final class AttestBootIntegrityPropertyEnum extends ExpandableStringEnum { + /** + * Boot integrity properties are valid. + */ + public static final AttestBootIntegrityPropertyEnum VALID = fromString("Valid"); + + /** + * Boot integrity properties are invalid. + */ + public static final AttestBootIntegrityPropertyEnum INVALID = fromString("Invalid"); + + /** + * Boot integrity properties status is unknown. + */ + public static final AttestBootIntegrityPropertyEnum UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of AttestBootIntegrityPropertyEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AttestBootIntegrityPropertyEnum() { + } + + /** + * Creates or finds a AttestBootIntegrityPropertyEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AttestBootIntegrityPropertyEnum. + */ + public static AttestBootIntegrityPropertyEnum fromString(String name) { + return fromString(name, AttestBootIntegrityPropertyEnum.class); + } + + /** + * Gets known AttestBootIntegrityPropertyEnum values. + * + * @return known AttestBootIntegrityPropertyEnum values. + */ + public static Collection values() { + return values(AttestBootIntegrityPropertyEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestCertPropertyEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestCertPropertyEnum.java new file mode 100644 index 000000000000..4ded4e847a29 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestCertPropertyEnum.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of whether attestation certificate is validated. + */ +public final class AttestCertPropertyEnum extends ExpandableStringEnum { + /** + * Attestation certificate is valid. + */ + public static final AttestCertPropertyEnum VALID = fromString("Valid"); + + /** + * Attestation certificate is invalid. + */ + public static final AttestCertPropertyEnum INVALID = fromString("Invalid"); + + /** + * Attestation certificate status is unknown. + */ + public static final AttestCertPropertyEnum UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of AttestCertPropertyEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AttestCertPropertyEnum() { + } + + /** + * Creates or finds a AttestCertPropertyEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AttestCertPropertyEnum. + */ + public static AttestCertPropertyEnum fromString(String name) { + return fromString(name, AttestCertPropertyEnum.class); + } + + /** + * Gets known AttestCertPropertyEnum values. + * + * @return known AttestCertPropertyEnum values. + */ + public static Collection values() { + return values(AttestCertPropertyEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestDiskSecurityEncryptionTypeEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestDiskSecurityEncryptionTypeEnum.java new file mode 100644 index 000000000000..d17fc524963a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestDiskSecurityEncryptionTypeEnum.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines type of managed disk security encryption type from attestation token. + */ +public final class AttestDiskSecurityEncryptionTypeEnum + extends ExpandableStringEnum { + /** + * Disk security encryption type is non-persisted Trusted Platform Module (TPM). + */ + public static final AttestDiskSecurityEncryptionTypeEnum NON_PERSISTED_TPM = fromString("NonPersistedTPM"); + + /** + * Disk security encryption type is unknown. + */ + public static final AttestDiskSecurityEncryptionTypeEnum UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of AttestDiskSecurityEncryptionTypeEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AttestDiskSecurityEncryptionTypeEnum() { + } + + /** + * Creates or finds a AttestDiskSecurityEncryptionTypeEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AttestDiskSecurityEncryptionTypeEnum. + */ + public static AttestDiskSecurityEncryptionTypeEnum fromString(String name) { + return fromString(name, AttestDiskSecurityEncryptionTypeEnum.class); + } + + /** + * Gets known AttestDiskSecurityEncryptionTypeEnum values. + * + * @return known AttestDiskSecurityEncryptionTypeEnum values. + */ + public static Collection values() { + return values(AttestDiskSecurityEncryptionTypeEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestHWPlatformEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestHWPlatformEnum.java new file mode 100644 index 000000000000..6a2380cfeaf6 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestHWPlatformEnum.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines type of hardware platform from attestation token. + */ +public final class AttestHWPlatformEnum extends ExpandableStringEnum { + /** + * AttestHWPlatform is Secure Encrypted Virtualization Secure Nested Paging (SEVSNP). + */ + public static final AttestHWPlatformEnum SEVSNP = fromString("SEVSNP"); + + /** + * AttestHWPlatform is unknown. + */ + public static final AttestHWPlatformEnum UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of AttestHWPlatformEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AttestHWPlatformEnum() { + } + + /** + * Creates or finds a AttestHWPlatformEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AttestHWPlatformEnum. + */ + public static AttestHWPlatformEnum fromString(String name) { + return fromString(name, AttestHWPlatformEnum.class); + } + + /** + * Gets known AttestHWPlatformEnum values. + * + * @return known AttestHWPlatformEnum values. + */ + public static Collection values() { + return values(AttestHWPlatformEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestHealthStatusEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestHealthStatusEnum.java new file mode 100644 index 000000000000..dfe77cbcfa9e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestHealthStatusEnum.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The health status of attestation validation and parsing. + */ +public final class AttestHealthStatusEnum extends ExpandableStringEnum { + /** + * Attestation validation and parsing pending. + */ + public static final AttestHealthStatusEnum PENDING = fromString("Pending"); + + /** + * Attestation validation and parsing healthy. + */ + public static final AttestHealthStatusEnum HEALTHY = fromString("Healthy"); + + /** + * Attestation validation and parsing unhealthy. + */ + public static final AttestHealthStatusEnum UNHEALTHY = fromString("Unhealthy"); + + /** + * Attestation validation and parsing status is unknown. + */ + public static final AttestHealthStatusEnum UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of AttestHealthStatusEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AttestHealthStatusEnum() { + } + + /** + * Creates or finds a AttestHealthStatusEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AttestHealthStatusEnum. + */ + public static AttestHealthStatusEnum fromString(String name) { + return fromString(name, AttestHealthStatusEnum.class); + } + + /** + * Gets known AttestHealthStatusEnum values. + * + * @return known AttestHealthStatusEnum values. + */ + public static Collection values() { + return values(AttestHealthStatusEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestSecureBootPropertyEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestSecureBootPropertyEnum.java new file mode 100644 index 000000000000..e9fc7c1ad594 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestSecureBootPropertyEnum.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of whether secure boot is enabled. + */ +public final class AttestSecureBootPropertyEnum extends ExpandableStringEnum { + /** + * Secure boot enabled. + */ + public static final AttestSecureBootPropertyEnum ENABLED = fromString("Enabled"); + + /** + * Secure boot disabled. + */ + public static final AttestSecureBootPropertyEnum DISABLED = fromString("Disabled"); + + /** + * Secure boot status is unknown. + */ + public static final AttestSecureBootPropertyEnum UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of AttestSecureBootPropertyEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AttestSecureBootPropertyEnum() { + } + + /** + * Creates or finds a AttestSecureBootPropertyEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AttestSecureBootPropertyEnum. + */ + public static AttestSecureBootPropertyEnum fromString(String name) { + return fromString(name, AttestSecureBootPropertyEnum.class); + } + + /** + * Gets known AttestSecureBootPropertyEnum values. + * + * @return known AttestSecureBootPropertyEnum values. + */ + public static Collection values() { + return values(AttestSecureBootPropertyEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestationStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestationStatus.java new file mode 100644 index 000000000000..9ba419fddfb5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestationStatus.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.AttestationStatusInner; + +/** + * An immutable client-side representation of AttestationStatus. + */ +public interface AttestationStatus { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + AttestationStatusProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.AttestationStatusInner object. + * + * @return the inner object. + */ + AttestationStatusInner innerModel(); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestationStatusProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestationStatusProperties.java new file mode 100644 index 000000000000..9914303a7da7 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestationStatusProperties.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Defines the attestation status properties. + */ +@Immutable +public final class AttestationStatusProperties implements JsonSerializable { + /* + * The status of whether secure boot is enabled. + */ + private AttestSecureBootPropertyEnum attestSecureBootEnabled; + + /* + * The status of whether attestation certificate is validated. + */ + private AttestCertPropertyEnum attestationCertValidated; + + /* + * The status of whether the list of boot integrity properties is validated. + */ + private AttestBootIntegrityPropertyEnum bootIntegrityValidated; + + /* + * kernel version string for Linux VM. + */ + private String linuxKernelVersion; + + /* + * The health status of attestation validation and parsing + */ + private AttestHealthStatusEnum healthStatus; + + /* + * The time stamp of the last time attestation token is validated by relying party service. + */ + private String timestamp; + + /* + * The error message of attestation validation and parsing + */ + private String errorMessage; + + /* + * Provisioning state of the virtual machine instance. + */ + private ProvisioningStateEnum provisioningState; + + /* + * The hardware platform information from attestation token. This only applies to Confidential VM. + */ + private AttestHWPlatformEnum attestHardwarePlatform; + + /* + * The managed disk security encryption type from attestation token. This only applies to Confidential VM. + */ + private AttestDiskSecurityEncryptionTypeEnum attestDiskSecurityEncryptionType; + + /** + * Creates an instance of AttestationStatusProperties class. + */ + private AttestationStatusProperties() { + } + + /** + * Get the attestSecureBootEnabled property: The status of whether secure boot is enabled. + * + * @return the attestSecureBootEnabled value. + */ + public AttestSecureBootPropertyEnum attestSecureBootEnabled() { + return this.attestSecureBootEnabled; + } + + /** + * Get the attestationCertValidated property: The status of whether attestation certificate is validated. + * + * @return the attestationCertValidated value. + */ + public AttestCertPropertyEnum attestationCertValidated() { + return this.attestationCertValidated; + } + + /** + * Get the bootIntegrityValidated property: The status of whether the list of boot integrity properties is + * validated. + * + * @return the bootIntegrityValidated value. + */ + public AttestBootIntegrityPropertyEnum bootIntegrityValidated() { + return this.bootIntegrityValidated; + } + + /** + * Get the linuxKernelVersion property: kernel version string for Linux VM. + * + * @return the linuxKernelVersion value. + */ + public String linuxKernelVersion() { + return this.linuxKernelVersion; + } + + /** + * Get the healthStatus property: The health status of attestation validation and parsing. + * + * @return the healthStatus value. + */ + public AttestHealthStatusEnum healthStatus() { + return this.healthStatus; + } + + /** + * Get the timestamp property: The time stamp of the last time attestation token is validated by relying party + * service. + * + * @return the timestamp value. + */ + public String timestamp() { + return this.timestamp; + } + + /** + * Get the errorMessage property: The error message of attestation validation and parsing. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the provisioningState property: Provisioning state of the virtual machine instance. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Get the attestHardwarePlatform property: The hardware platform information from attestation token. This only + * applies to Confidential VM. + * + * @return the attestHardwarePlatform value. + */ + public AttestHWPlatformEnum attestHardwarePlatform() { + return this.attestHardwarePlatform; + } + + /** + * Get the attestDiskSecurityEncryptionType property: The managed disk security encryption type from attestation + * token. This only applies to Confidential VM. + * + * @return the attestDiskSecurityEncryptionType value. + */ + public AttestDiskSecurityEncryptionTypeEnum attestDiskSecurityEncryptionType() { + return this.attestDiskSecurityEncryptionType; + } + + /** + * 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 AttestationStatusProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AttestationStatusProperties 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 AttestationStatusProperties. + */ + public static AttestationStatusProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AttestationStatusProperties deserializedAttestationStatusProperties = new AttestationStatusProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("attestSecureBootEnabled".equals(fieldName)) { + deserializedAttestationStatusProperties.attestSecureBootEnabled + = AttestSecureBootPropertyEnum.fromString(reader.getString()); + } else if ("attestationCertValidated".equals(fieldName)) { + deserializedAttestationStatusProperties.attestationCertValidated + = AttestCertPropertyEnum.fromString(reader.getString()); + } else if ("bootIntegrityValidated".equals(fieldName)) { + deserializedAttestationStatusProperties.bootIntegrityValidated + = AttestBootIntegrityPropertyEnum.fromString(reader.getString()); + } else if ("linuxKernelVersion".equals(fieldName)) { + deserializedAttestationStatusProperties.linuxKernelVersion = reader.getString(); + } else if ("healthStatus".equals(fieldName)) { + deserializedAttestationStatusProperties.healthStatus + = AttestHealthStatusEnum.fromString(reader.getString()); + } else if ("timestamp".equals(fieldName)) { + deserializedAttestationStatusProperties.timestamp = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedAttestationStatusProperties.errorMessage = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedAttestationStatusProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else if ("attestHardwarePlatform".equals(fieldName)) { + deserializedAttestationStatusProperties.attestHardwarePlatform + = AttestHWPlatformEnum.fromString(reader.getString()); + } else if ("attestDiskSecurityEncryptionType".equals(fieldName)) { + deserializedAttestationStatusProperties.attestDiskSecurityEncryptionType + = AttestDiskSecurityEncryptionTypeEnum.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAttestationStatusProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestationStatuses.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestationStatuses.java new file mode 100644 index 000000000000..384a15d70804 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/AttestationStatuses.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of AttestationStatuses. + */ +public interface AttestationStatuses { + /** + * Implements AttestationStatus GET method. + * + * @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 attestation status of the virtual machine along with {@link Response}. + */ + Response getWithResponse(String resourceUri, Context context); + + /** + * Implements AttestationStatus GET method. + * + * @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 attestation status of the virtual machine. + */ + AttestationStatus get(String resourceUri); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/CloudInitDataSource.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/CloudInitDataSource.java new file mode 100644 index 000000000000..bd166c85cda1 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/CloudInitDataSource.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure]. + */ +public final class CloudInitDataSource extends ExpandableStringEnum { + /** + * NoCloud is used as the datasource. + */ + public static final CloudInitDataSource NO_CLOUD = fromString("NoCloud"); + + /** + * Azure is used as the datasource. + */ + public static final CloudInitDataSource AZURE = fromString("Azure"); + + /** + * Creates a new instance of CloudInitDataSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CloudInitDataSource() { + } + + /** + * Creates or finds a CloudInitDataSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding CloudInitDataSource. + */ + public static CloudInitDataSource fromString(String name) { + return fromString(name, CloudInitDataSource.class); + } + + /** + * Gets known CloudInitDataSource values. + * + * @return known CloudInitDataSource values. + */ + public static Collection values() { + return values(CloudInitDataSource.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/DiskFileFormat.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/DiskFileFormat.java new file mode 100644 index 000000000000..662d52e2484e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/DiskFileFormat.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The format of the actual VHD file [vhd, vhdx]. + */ +public final class DiskFileFormat extends ExpandableStringEnum { + /** + * VHDX file format. + */ + public static final DiskFileFormat VHDX = fromString("vhdx"); + + /** + * VHD file format. + */ + public static final DiskFileFormat VHD = fromString("vhd"); + + /** + * Creates a new instance of DiskFileFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DiskFileFormat() { + } + + /** + * Creates or finds a DiskFileFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding DiskFileFormat. + */ + public static DiskFileFormat fromString(String name) { + return fromString(name, DiskFileFormat.class); + } + + /** + * Gets known DiskFileFormat values. + * + * @return known DiskFileFormat values. + */ + public static Collection values() { + return values(DiskFileFormat.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ExtendedLocation.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ExtendedLocation.java new file mode 100644 index 000000000000..d5b2296b102b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ExtendedLocation.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The complex type of the extended location. + */ +@Fluent +public final class ExtendedLocation implements JsonSerializable { + /* + * The name of the extended location. + */ + private String name; + + /* + * The type of the extended location. + */ + private ExtendedLocationTypes type; + + /** + * Creates an instance of ExtendedLocation class. + */ + public ExtendedLocation() { + } + + /** + * Get the name property: The name of the extended location. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the extended location. + * + * @param name the name value to set. + * @return the ExtendedLocation object itself. + */ + public ExtendedLocation withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The type of the extended location. + * + * @return the type value. + */ + public ExtendedLocationTypes type() { + return this.type; + } + + /** + * Set the type property: The type of the extended location. + * + * @param type the type value to set. + * @return the ExtendedLocation object itself. + */ + public ExtendedLocation withType(ExtendedLocationTypes type) { + this.type = type; + 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("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtendedLocation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtendedLocation 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 ExtendedLocation. + */ + public static ExtendedLocation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtendedLocation deserializedExtendedLocation = new ExtendedLocation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedExtendedLocation.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedExtendedLocation.type = ExtendedLocationTypes.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedExtendedLocation; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ExtendedLocationTypes.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ExtendedLocationTypes.java new file mode 100644 index 000000000000..602a8d01fb78 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ExtendedLocationTypes.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of extendedLocation. + */ +public final class ExtendedLocationTypes extends ExpandableStringEnum { + /** + * Custom extended location type. + */ + public static final ExtendedLocationTypes CUSTOM_LOCATION = fromString("CustomLocation"); + + /** + * Creates a new instance of ExtendedLocationTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ExtendedLocationTypes() { + } + + /** + * Creates or finds a ExtendedLocationTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExtendedLocationTypes. + */ + public static ExtendedLocationTypes fromString(String name) { + return fromString(name, ExtendedLocationTypes.class); + } + + /** + * Gets known ExtendedLocationTypes values. + * + * @return known ExtendedLocationTypes values. + */ + public static Collection values() { + return values(ExtendedLocationTypes.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImage.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImage.java new file mode 100644 index 000000000000..a74a56cc375d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImage.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GalleryImageInner; +import java.util.Map; + +/** + * An immutable client-side representation of GalleryImage. + */ +public interface GalleryImage { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + GalleryImageProperties properties(); + + /** + * Gets the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.GalleryImageInner object. + * + * @return the inner object. + */ + GalleryImageInner innerModel(); + + /** + * The entirety of the GalleryImage definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The GalleryImage definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the GalleryImage definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the GalleryImage 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 GalleryImage 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 GalleryImage definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithExtendedLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + GalleryImage create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + GalleryImage create(Context context); + } + + /** + * The stage of the GalleryImage 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 GalleryImage definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(GalleryImageProperties properties); + } + + /** + * The stage of the GalleryImage definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extendedLocation of the resource.. + * + * @param extendedLocation The extendedLocation of the resource. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + } + + /** + * Begins update for the GalleryImage resource. + * + * @return the stage of resource update. + */ + GalleryImage.Update update(); + + /** + * The template for GalleryImage update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + GalleryImage apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + GalleryImage apply(Context context); + } + + /** + * The GalleryImage update stages. + */ + interface UpdateStages { + /** + * The stage of the GalleryImage 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); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + GalleryImage refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + GalleryImage refresh(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageIdentifier.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageIdentifier.java new file mode 100644 index 000000000000..9a269e2e3086 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageIdentifier.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * This is the gallery image definition identifier. + */ +@Fluent +public final class GalleryImageIdentifier implements JsonSerializable { + /* + * The name of the gallery image definition publisher. + */ + private String publisher; + + /* + * The name of the gallery image definition offer. + */ + private String offer; + + /* + * The name of the gallery image definition SKU. + */ + private String sku; + + /** + * Creates an instance of GalleryImageIdentifier class. + */ + public GalleryImageIdentifier() { + } + + /** + * Get the publisher property: The name of the gallery image definition publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the gallery image definition publisher. + * + * @param publisher the publisher value to set. + * @return the GalleryImageIdentifier object itself. + */ + public GalleryImageIdentifier withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the offer property: The name of the gallery image definition offer. + * + * @return the offer value. + */ + public String offer() { + return this.offer; + } + + /** + * Set the offer property: The name of the gallery image definition offer. + * + * @param offer the offer value to set. + * @return the GalleryImageIdentifier object itself. + */ + public GalleryImageIdentifier withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Get the sku property: The name of the gallery image definition SKU. + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: The name of the gallery image definition SKU. + * + * @param sku the sku value to set. + * @return the GalleryImageIdentifier object itself. + */ + public GalleryImageIdentifier withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (publisher() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property publisher in model GalleryImageIdentifier")); + } + if (offer() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property offer in model GalleryImageIdentifier")); + } + if (sku() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property sku in model GalleryImageIdentifier")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GalleryImageIdentifier.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("publisher", this.publisher); + jsonWriter.writeStringField("offer", this.offer); + jsonWriter.writeStringField("sku", this.sku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GalleryImageIdentifier from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryImageIdentifier 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 GalleryImageIdentifier. + */ + public static GalleryImageIdentifier fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryImageIdentifier deserializedGalleryImageIdentifier = new GalleryImageIdentifier(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("publisher".equals(fieldName)) { + deserializedGalleryImageIdentifier.publisher = reader.getString(); + } else if ("offer".equals(fieldName)) { + deserializedGalleryImageIdentifier.offer = reader.getString(); + } else if ("sku".equals(fieldName)) { + deserializedGalleryImageIdentifier.sku = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryImageIdentifier; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageProperties.java new file mode 100644 index 000000000000..e961f7c70ed7 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageProperties.java @@ -0,0 +1,384 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Properties under the gallery image resource. + */ +@Fluent +public final class GalleryImageProperties implements JsonSerializable { + /* + * Storage ContainerID of the storage container to be used for gallery image + */ + private String containerId; + + /* + * location of the image the gallery image should be created from + */ + private String imagePath; + + /* + * Operating system type that the gallery image uses [Windows, Linux] + */ + private OperatingSystemTypes osType; + + /* + * Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + */ + private CloudInitDataSource cloudInitDataSource; + + /* + * The hypervisor generation of the Virtual Machine [V1, V2] + */ + private HyperVGeneration hyperVGeneration; + + /* + * The credentials used to login to the image repository that has access to the specified image + */ + private VmImageRepositoryCredentials vmImageRepositoryCredentials; + + /* + * This is the gallery image definition identifier. + */ + private GalleryImageIdentifier identifier; + + /* + * Specifies information about the gallery image version that you want to create or update. + */ + private GalleryImageVersion version; + + /* + * Provisioning state of the gallery image. + */ + private ProvisioningStateEnum provisioningState; + + /* + * The observed state of gallery images + */ + private GalleryImageStatus status; + + /* + * Resource ID of the source virtual machine from whose OS disk the gallery image is created. + */ + private String sourceVirtualMachineId; + + /** + * Creates an instance of GalleryImageProperties class. + */ + public GalleryImageProperties() { + } + + /** + * Get the containerId property: Storage ContainerID of the storage container to be used for gallery image. + * + * @return the containerId value. + */ + public String containerId() { + return this.containerId; + } + + /** + * Set the containerId property: Storage ContainerID of the storage container to be used for gallery image. + * + * @param containerId the containerId value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withContainerId(String containerId) { + this.containerId = containerId; + return this; + } + + /** + * Get the imagePath property: location of the image the gallery image should be created from. + * + * @return the imagePath value. + */ + public String imagePath() { + return this.imagePath; + } + + /** + * Set the imagePath property: location of the image the gallery image should be created from. + * + * @param imagePath the imagePath value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withImagePath(String imagePath) { + this.imagePath = imagePath; + return this; + } + + /** + * Get the osType property: Operating system type that the gallery image uses [Windows, Linux]. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.osType; + } + + /** + * Set the osType property: Operating system type that the gallery image uses [Windows, Linux]. + * + * @param osType the osType value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the cloudInitDataSource property: Datasource for the gallery image when provisioning with cloud-init + * [NoCloud, Azure]. + * + * @return the cloudInitDataSource value. + */ + public CloudInitDataSource cloudInitDataSource() { + return this.cloudInitDataSource; + } + + /** + * Set the cloudInitDataSource property: Datasource for the gallery image when provisioning with cloud-init + * [NoCloud, Azure]. + * + * @param cloudInitDataSource the cloudInitDataSource value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withCloudInitDataSource(CloudInitDataSource cloudInitDataSource) { + this.cloudInitDataSource = cloudInitDataSource; + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine [V1, V2]. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine [V1, V2]. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withHyperVGeneration(HyperVGeneration hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Get the vmImageRepositoryCredentials property: The credentials used to login to the image repository that has + * access to the specified image. + * + * @return the vmImageRepositoryCredentials value. + */ + public VmImageRepositoryCredentials vmImageRepositoryCredentials() { + return this.vmImageRepositoryCredentials; + } + + /** + * Set the vmImageRepositoryCredentials property: The credentials used to login to the image repository that has + * access to the specified image. + * + * @param vmImageRepositoryCredentials the vmImageRepositoryCredentials value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties + withVmImageRepositoryCredentials(VmImageRepositoryCredentials vmImageRepositoryCredentials) { + this.vmImageRepositoryCredentials = vmImageRepositoryCredentials; + return this; + } + + /** + * Get the identifier property: This is the gallery image definition identifier. + * + * @return the identifier value. + */ + public GalleryImageIdentifier identifier() { + return this.identifier; + } + + /** + * Set the identifier property: This is the gallery image definition identifier. + * + * @param identifier the identifier value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withIdentifier(GalleryImageIdentifier identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get the version property: Specifies information about the gallery image version that you want to create or + * update. + * + * @return the version value. + */ + public GalleryImageVersion version() { + return this.version; + } + + /** + * Set the version property: Specifies information about the gallery image version that you want to create or + * update. + * + * @param version the version value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withVersion(GalleryImageVersion version) { + this.version = version; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the gallery image. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Get the status property: The observed state of gallery images. + * + * @return the status value. + */ + public GalleryImageStatus status() { + return this.status; + } + + /** + * Get the sourceVirtualMachineId property: Resource ID of the source virtual machine from whose OS disk the gallery + * image is created. + * + * @return the sourceVirtualMachineId value. + */ + public String sourceVirtualMachineId() { + return this.sourceVirtualMachineId; + } + + /** + * Set the sourceVirtualMachineId property: Resource ID of the source virtual machine from whose OS disk the gallery + * image is created. + * + * @param sourceVirtualMachineId the sourceVirtualMachineId value to set. + * @return the GalleryImageProperties object itself. + */ + public GalleryImageProperties withSourceVirtualMachineId(String sourceVirtualMachineId) { + this.sourceVirtualMachineId = sourceVirtualMachineId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property osType in model GalleryImageProperties")); + } + if (vmImageRepositoryCredentials() != null) { + vmImageRepositoryCredentials().validate(); + } + if (identifier() != null) { + identifier().validate(); + } + if (version() != null) { + version().validate(); + } + if (status() != null) { + status().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GalleryImageProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("osType", this.osType == null ? null : this.osType.toString()); + jsonWriter.writeStringField("containerId", this.containerId); + jsonWriter.writeStringField("imagePath", this.imagePath); + jsonWriter.writeStringField("cloudInitDataSource", + this.cloudInitDataSource == null ? null : this.cloudInitDataSource.toString()); + jsonWriter.writeStringField("hyperVGeneration", + this.hyperVGeneration == null ? null : this.hyperVGeneration.toString()); + jsonWriter.writeJsonField("vmImageRepositoryCredentials", this.vmImageRepositoryCredentials); + jsonWriter.writeJsonField("identifier", this.identifier); + jsonWriter.writeJsonField("version", this.version); + jsonWriter.writeStringField("sourceVirtualMachineId", this.sourceVirtualMachineId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GalleryImageProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryImageProperties 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 GalleryImageProperties. + */ + public static GalleryImageProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryImageProperties deserializedGalleryImageProperties = new GalleryImageProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("osType".equals(fieldName)) { + deserializedGalleryImageProperties.osType = OperatingSystemTypes.fromString(reader.getString()); + } else if ("containerId".equals(fieldName)) { + deserializedGalleryImageProperties.containerId = reader.getString(); + } else if ("imagePath".equals(fieldName)) { + deserializedGalleryImageProperties.imagePath = reader.getString(); + } else if ("cloudInitDataSource".equals(fieldName)) { + deserializedGalleryImageProperties.cloudInitDataSource + = CloudInitDataSource.fromString(reader.getString()); + } else if ("hyperVGeneration".equals(fieldName)) { + deserializedGalleryImageProperties.hyperVGeneration + = HyperVGeneration.fromString(reader.getString()); + } else if ("vmImageRepositoryCredentials".equals(fieldName)) { + deserializedGalleryImageProperties.vmImageRepositoryCredentials + = VmImageRepositoryCredentials.fromJson(reader); + } else if ("identifier".equals(fieldName)) { + deserializedGalleryImageProperties.identifier = GalleryImageIdentifier.fromJson(reader); + } else if ("version".equals(fieldName)) { + deserializedGalleryImageProperties.version = GalleryImageVersion.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedGalleryImageProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedGalleryImageProperties.status = GalleryImageStatus.fromJson(reader); + } else if ("sourceVirtualMachineId".equals(fieldName)) { + deserializedGalleryImageProperties.sourceVirtualMachineId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryImageProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageStatus.java new file mode 100644 index 000000000000..bff83a15846b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageStatus.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The observed state of gallery images. + */ +@Immutable +public final class GalleryImageStatus implements JsonSerializable { + /* + * GalleryImage provisioning error code + */ + private String errorCode; + + /* + * Descriptive error message + */ + private String errorMessage; + + /* + * provisioning status of the gallery image + */ + private GalleryImageStatusProvisioningStatus provisioningStatus; + + /* + * The download status of the gallery image + */ + private GalleryImageStatusDownloadStatus downloadStatus; + + /* + * The progress of the operation in percentage + */ + private Long progressPercentage; + + /** + * Creates an instance of GalleryImageStatus class. + */ + private GalleryImageStatus() { + } + + /** + * Get the errorCode property: GalleryImage provisioning error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: Descriptive error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the provisioningStatus property: provisioning status of the gallery image. + * + * @return the provisioningStatus value. + */ + public GalleryImageStatusProvisioningStatus provisioningStatus() { + return this.provisioningStatus; + } + + /** + * Get the downloadStatus property: The download status of the gallery image. + * + * @return the downloadStatus value. + */ + public GalleryImageStatusDownloadStatus downloadStatus() { + return this.downloadStatus; + } + + /** + * Get the progressPercentage property: The progress of the operation in percentage. + * + * @return the progressPercentage value. + */ + public Long progressPercentage() { + return this.progressPercentage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provisioningStatus() != null) { + provisioningStatus().validate(); + } + if (downloadStatus() != null) { + downloadStatus().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeJsonField("provisioningStatus", this.provisioningStatus); + jsonWriter.writeJsonField("downloadStatus", this.downloadStatus); + jsonWriter.writeNumberField("progressPercentage", this.progressPercentage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GalleryImageStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryImageStatus 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 GalleryImageStatus. + */ + public static GalleryImageStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryImageStatus deserializedGalleryImageStatus = new GalleryImageStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedGalleryImageStatus.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedGalleryImageStatus.errorMessage = reader.getString(); + } else if ("provisioningStatus".equals(fieldName)) { + deserializedGalleryImageStatus.provisioningStatus + = GalleryImageStatusProvisioningStatus.fromJson(reader); + } else if ("downloadStatus".equals(fieldName)) { + deserializedGalleryImageStatus.downloadStatus = GalleryImageStatusDownloadStatus.fromJson(reader); + } else if ("progressPercentage".equals(fieldName)) { + deserializedGalleryImageStatus.progressPercentage = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryImageStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageStatusDownloadStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageStatusDownloadStatus.java new file mode 100644 index 000000000000..bf33a38f60ec --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageStatusDownloadStatus.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The download status of the gallery image. + */ +@Immutable +public final class GalleryImageStatusDownloadStatus implements JsonSerializable { + /* + * The downloaded sized of the image in MB + */ + private Long downloadSizeInMB; + + /** + * Creates an instance of GalleryImageStatusDownloadStatus class. + */ + private GalleryImageStatusDownloadStatus() { + } + + /** + * Get the downloadSizeInMB property: The downloaded sized of the image in MB. + * + * @return the downloadSizeInMB value. + */ + public Long downloadSizeInMB() { + return this.downloadSizeInMB; + } + + /** + * 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("downloadSizeInMB", this.downloadSizeInMB); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GalleryImageStatusDownloadStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryImageStatusDownloadStatus 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 GalleryImageStatusDownloadStatus. + */ + public static GalleryImageStatusDownloadStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryImageStatusDownloadStatus deserializedGalleryImageStatusDownloadStatus + = new GalleryImageStatusDownloadStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("downloadSizeInMB".equals(fieldName)) { + deserializedGalleryImageStatusDownloadStatus.downloadSizeInMB + = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryImageStatusDownloadStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageStatusProvisioningStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageStatusProvisioningStatus.java new file mode 100644 index 000000000000..f6c69839ef9c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageStatusProvisioningStatus.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The status of the operation performed on the gallery image. + */ +@Immutable +public final class GalleryImageStatusProvisioningStatus + implements JsonSerializable { + /* + * The ID of the operation performed on the gallery image + */ + private String operationId; + + /* + * The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + */ + private Status status; + + /** + * Creates an instance of GalleryImageStatusProvisioningStatus class. + */ + private GalleryImageStatusProvisioningStatus() { + } + + /** + * Get the operationId property: The ID of the operation performed on the gallery image. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the status property: The status of the operation performed on the gallery image [Succeeded, Failed, + * InProgress]. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * 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("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GalleryImageStatusProvisioningStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryImageStatusProvisioningStatus 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 GalleryImageStatusProvisioningStatus. + */ + public static GalleryImageStatusProvisioningStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryImageStatusProvisioningStatus deserializedGalleryImageStatusProvisioningStatus + = new GalleryImageStatusProvisioningStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + deserializedGalleryImageStatusProvisioningStatus.operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedGalleryImageStatusProvisioningStatus.status = Status.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryImageStatusProvisioningStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageTagsUpdate.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageTagsUpdate.java new file mode 100644 index 000000000000..237ba1e6865d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageTagsUpdate.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The type used for updating tags in GalleryImage resources. + */ +@Fluent +public final class GalleryImageTagsUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of GalleryImageTagsUpdate class. + */ + public GalleryImageTagsUpdate() { + } + + /** + * 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 GalleryImageTagsUpdate object itself. + */ + public GalleryImageTagsUpdate withTags(Map tags) { + this.tags = tags; + 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.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GalleryImageTagsUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryImageTagsUpdate 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 GalleryImageTagsUpdate. + */ + public static GalleryImageTagsUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryImageTagsUpdate deserializedGalleryImageTagsUpdate = new GalleryImageTagsUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedGalleryImageTagsUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryImageTagsUpdate; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageVersion.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageVersion.java new file mode 100644 index 000000000000..22435836fc1e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageVersion.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.GalleryImageVersionProperties; +import java.io.IOException; + +/** + * Specifies information about the gallery image version that you want to create or update. + */ +@Fluent +public final class GalleryImageVersion implements JsonSerializable { + /* + * This is the version of the gallery image. + */ + private String name; + + /* + * Describes the properties of a gallery image version. + */ + private GalleryImageVersionProperties innerProperties; + + /** + * Creates an instance of GalleryImageVersion class. + */ + public GalleryImageVersion() { + } + + /** + * Get the name property: This is the version of the gallery image. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: This is the version of the gallery image. + * + * @param name the name value to set. + * @return the GalleryImageVersion object itself. + */ + public GalleryImageVersion withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: Describes the properties of a gallery image version. + * + * @return the innerProperties value. + */ + private GalleryImageVersionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the storageProfile property: This is the storage profile of a Gallery Image Version. + * + * @return the storageProfile value. + */ + public GalleryImageVersionStorageProfile storageProfile() { + return this.innerProperties() == null ? null : this.innerProperties().storageProfile(); + } + + /** + * Set the storageProfile property: This is the storage profile of a Gallery Image Version. + * + * @param storageProfile the storageProfile value to set. + * @return the GalleryImageVersion object itself. + */ + public GalleryImageVersion withStorageProfile(GalleryImageVersionStorageProfile storageProfile) { + if (this.innerProperties() == null) { + this.innerProperties = new GalleryImageVersionProperties(); + } + this.innerProperties().withStorageProfile(storageProfile); + 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("name", this.name); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GalleryImageVersion from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryImageVersion 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 GalleryImageVersion. + */ + public static GalleryImageVersion fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryImageVersion deserializedGalleryImageVersion = new GalleryImageVersion(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedGalleryImageVersion.name = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedGalleryImageVersion.innerProperties = GalleryImageVersionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryImageVersion; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageVersionStorageProfile.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageVersionStorageProfile.java new file mode 100644 index 000000000000..50bb2f869fd4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImageVersionStorageProfile.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * This is the storage profile of a Gallery Image Version. + */ +@Fluent +public final class GalleryImageVersionStorageProfile implements JsonSerializable { + /* + * This is the OS disk image. + */ + private GalleryOSDiskImage osDiskImage; + + /** + * Creates an instance of GalleryImageVersionStorageProfile class. + */ + public GalleryImageVersionStorageProfile() { + } + + /** + * Get the osDiskImage property: This is the OS disk image. + * + * @return the osDiskImage value. + */ + public GalleryOSDiskImage osDiskImage() { + return this.osDiskImage; + } + + /** + * Set the osDiskImage property: This is the OS disk image. + * + * @param osDiskImage the osDiskImage value to set. + * @return the GalleryImageVersionStorageProfile object itself. + */ + public GalleryImageVersionStorageProfile withOsDiskImage(GalleryOSDiskImage osDiskImage) { + this.osDiskImage = osDiskImage; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osDiskImage() != null) { + osDiskImage().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("osDiskImage", this.osDiskImage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GalleryImageVersionStorageProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryImageVersionStorageProfile 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 GalleryImageVersionStorageProfile. + */ + public static GalleryImageVersionStorageProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryImageVersionStorageProfile deserializedGalleryImageVersionStorageProfile + = new GalleryImageVersionStorageProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("osDiskImage".equals(fieldName)) { + deserializedGalleryImageVersionStorageProfile.osDiskImage = GalleryOSDiskImage.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryImageVersionStorageProfile; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImages.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImages.java new file mode 100644 index 000000000000..eca86cd9ea73 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryImages.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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 GalleryImages. + */ +public interface GalleryImages { + /** + * Gets a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 gallery image along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String galleryImageName, + Context context); + + /** + * Gets a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 gallery image. + */ + GalleryImage getByResourceGroup(String resourceGroupName, String galleryImageName); + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 galleryImageName); + + /** + * The operation to delete a gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param galleryImageName Name of the gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 galleryImageName, Context context); + + /** + * Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @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 GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the gallery images in the specified resource group. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @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 GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the gallery images in the specified subscription. Use the nextLink property in the response to get + * the next page of gallery images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a GalleryImage list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a gallery image. + * + * @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 gallery image along with {@link Response}. + */ + GalleryImage getById(String id); + + /** + * Gets a gallery image. + * + * @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 gallery image along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The operation to delete a gallery image. + * + * @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); + + /** + * The operation to delete a gallery image. + * + * @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 GalleryImage resource. + * + * @param name resource name. + * @return the first stage of the new GalleryImage definition. + */ + GalleryImage.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryOSDiskImage.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryOSDiskImage.java new file mode 100644 index 000000000000..bad3f6ee46b8 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GalleryOSDiskImage.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * This is the OS disk image. + */ +@Immutable +public final class GalleryOSDiskImage implements JsonSerializable { + /* + * This property indicates the size of the VHD to be created. + */ + private Long sizeInMB; + + /** + * Creates an instance of GalleryOSDiskImage class. + */ + public GalleryOSDiskImage() { + } + + /** + * Get the sizeInMB property: This property indicates the size of the VHD to be created. + * + * @return the sizeInMB value. + */ + public Long sizeInMB() { + return this.sizeInMB; + } + + /** + * 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 GalleryOSDiskImage from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GalleryOSDiskImage 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 GalleryOSDiskImage. + */ + public static GalleryOSDiskImage fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GalleryOSDiskImage deserializedGalleryOSDiskImage = new GalleryOSDiskImage(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sizeInMB".equals(fieldName)) { + deserializedGalleryOSDiskImage.sizeInMB = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedGalleryOSDiskImage; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GpuAssignmentTypeEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GpuAssignmentTypeEnum.java new file mode 100644 index 000000000000..8591fb1a49a0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GpuAssignmentTypeEnum.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Gpu Assignment types. + */ +public final class GpuAssignmentTypeEnum extends ExpandableStringEnum { + /** + * Attach Graphics Processing Unit (GPU) using Discrete Device Assignment (DDA). + */ + public static final GpuAssignmentTypeEnum GPU_DDA = fromString("GpuDDA"); + + /** + * Attach Graphics Processing Unit (GPU) using GPU Partitioning. + */ + public static final GpuAssignmentTypeEnum GPUP = fromString("GpuP"); + + /** + * Creates a new instance of GpuAssignmentTypeEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public GpuAssignmentTypeEnum() { + } + + /** + * Creates or finds a GpuAssignmentTypeEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding GpuAssignmentTypeEnum. + */ + public static GpuAssignmentTypeEnum fromString(String name) { + return fromString(name, GpuAssignmentTypeEnum.class); + } + + /** + * Gets known GpuAssignmentTypeEnum values. + * + * @return known GpuAssignmentTypeEnum values. + */ + public static Collection values() { + return values(GpuAssignmentTypeEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgent.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgent.java new file mode 100644 index 000000000000..0b627aa4a112 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgent.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GuestAgentInner; + +/** + * An immutable client-side representation of GuestAgent. + */ +public interface GuestAgent { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + GuestAgentProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.GuestAgentInner object. + * + * @return the inner object. + */ + GuestAgentInner innerModel(); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgentInstallStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgentInstallStatus.java new file mode 100644 index 000000000000..b608fbe98603 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgentInstallStatus.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.ManagementError; +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.util.List; + +/** + * Defines the status of a guest agent installation. + */ +@Immutable +public final class GuestAgentInstallStatus implements JsonSerializable { + /* + * Specifies the VM's unique SMBIOS ID. + */ + private String vmUuid; + + /* + * The installation status of the hybrid machine agent installation. + */ + private StatusTypes status; + + /* + * The time of the last status change. + */ + private OffsetDateTime lastStatusChange; + + /* + * The hybrid machine agent full version. + */ + private String agentVersion; + + /* + * Details about the error state. + */ + private List errorDetails; + + /** + * Creates an instance of GuestAgentInstallStatus class. + */ + public GuestAgentInstallStatus() { + } + + /** + * Get the vmUuid property: Specifies the VM's unique SMBIOS ID. + * + * @return the vmUuid value. + */ + public String vmUuid() { + return this.vmUuid; + } + + /** + * Get the status property: The installation status of the hybrid machine agent installation. + * + * @return the status value. + */ + public StatusTypes status() { + return this.status; + } + + /** + * Get the lastStatusChange property: The time of the last status change. + * + * @return the lastStatusChange value. + */ + public OffsetDateTime lastStatusChange() { + return this.lastStatusChange; + } + + /** + * Get the agentVersion property: The hybrid machine agent full version. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Get the errorDetails property: Details about the error state. + * + * @return the errorDetails value. + */ + public List errorDetails() { + return this.errorDetails; + } + + /** + * 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 GuestAgentInstallStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GuestAgentInstallStatus 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 GuestAgentInstallStatus. + */ + public static GuestAgentInstallStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GuestAgentInstallStatus deserializedGuestAgentInstallStatus = new GuestAgentInstallStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vmUuid".equals(fieldName)) { + deserializedGuestAgentInstallStatus.vmUuid = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedGuestAgentInstallStatus.status = StatusTypes.fromString(reader.getString()); + } else if ("lastStatusChange".equals(fieldName)) { + deserializedGuestAgentInstallStatus.lastStatusChange = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("agentVersion".equals(fieldName)) { + deserializedGuestAgentInstallStatus.agentVersion = reader.getString(); + } else if ("errorDetails".equals(fieldName)) { + List errorDetails = reader.readArray(reader1 -> ManagementError.fromJson(reader1)); + deserializedGuestAgentInstallStatus.errorDetails = errorDetails; + } else { + reader.skipChildren(); + } + } + + return deserializedGuestAgentInstallStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgentProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgentProperties.java new file mode 100644 index 000000000000..c7c7c20e8feb --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgentProperties.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Defines the resource properties. + */ +@Fluent +public final class GuestAgentProperties implements JsonSerializable { + /* + * Username / Password Credentials to provision guest agent. + */ + private GuestCredential credentials; + + /* + * The guest agent provisioning action. + */ + private ProvisioningAction provisioningAction; + + /* + * The guest agent status. + */ + private String status; + + /* + * Provisioning state of the virtual machine instance. + */ + private ProvisioningStateEnum provisioningState; + + /** + * Creates an instance of GuestAgentProperties class. + */ + public GuestAgentProperties() { + } + + /** + * Get the credentials property: Username / Password Credentials to provision guest agent. + * + * @return the credentials value. + */ + public GuestCredential credentials() { + return this.credentials; + } + + /** + * Set the credentials property: Username / Password Credentials to provision guest agent. + * + * @param credentials the credentials value to set. + * @return the GuestAgentProperties object itself. + */ + public GuestAgentProperties withCredentials(GuestCredential credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get the provisioningAction property: The guest agent provisioning action. + * + * @return the provisioningAction value. + */ + public ProvisioningAction provisioningAction() { + return this.provisioningAction; + } + + /** + * Set the provisioningAction property: The guest agent provisioning action. + * + * @param provisioningAction the provisioningAction value to set. + * @return the GuestAgentProperties object itself. + */ + public GuestAgentProperties withProvisioningAction(ProvisioningAction provisioningAction) { + this.provisioningAction = provisioningAction; + return this; + } + + /** + * Get the status property: The guest agent status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the provisioningState property: Provisioning state of the virtual machine instance. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (credentials() != null) { + credentials().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("credentials", this.credentials); + jsonWriter.writeStringField("provisioningAction", + this.provisioningAction == null ? null : this.provisioningAction.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GuestAgentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GuestAgentProperties 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 GuestAgentProperties. + */ + public static GuestAgentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GuestAgentProperties deserializedGuestAgentProperties = new GuestAgentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("credentials".equals(fieldName)) { + deserializedGuestAgentProperties.credentials = GuestCredential.fromJson(reader); + } else if ("provisioningAction".equals(fieldName)) { + deserializedGuestAgentProperties.provisioningAction + = ProvisioningAction.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedGuestAgentProperties.status = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedGuestAgentProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedGuestAgentProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgents.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgents.java new file mode 100644 index 000000000000..68529b82aca6 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestAgents.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GuestAgentInner; + +/** + * Resource collection API of GuestAgents. + */ +public interface GuestAgents { + /** + * Implements GuestAgent GET method. + * + * @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 defines the GuestAgent along with {@link Response}. + */ + Response getWithResponse(String resourceUri, Context context); + + /** + * Implements GuestAgent GET method. + * + * @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 defines the GuestAgent. + */ + GuestAgent get(String resourceUri); + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent. + */ + GuestAgent create(String resourceUri, GuestAgentInner resource); + + /** + * Create Or Update GuestAgent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 defines the GuestAgent. + */ + GuestAgent create(String resourceUri, GuestAgentInner resource, Context context); + + /** + * Implements GuestAgent DELETE method. + * + * @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. + */ + void delete(String resourceUri); + + /** + * Implements GuestAgent DELETE method. + * + * @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. + */ + void delete(String resourceUri, Context context); + + /** + * Returns the list of GuestAgent of the given vm. + * + * @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 GuestAgent list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVirtualMachineInstance(String resourceUri); + + /** + * Returns the list of GuestAgent of the given vm. + * + * @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 GuestAgent list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVirtualMachineInstance(String resourceUri, Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestCredential.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestCredential.java new file mode 100644 index 000000000000..76ae709c31df --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/GuestCredential.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Username / Password Credentials to connect to guest. + */ +@Fluent +public final class GuestCredential implements JsonSerializable { + /* + * The username to connect with the guest. + */ + private String username; + + /* + * The password to connect with the guest. + */ + private String password; + + /** + * Creates an instance of GuestCredential class. + */ + public GuestCredential() { + } + + /** + * Get the username property: The username to connect with the guest. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The username to connect with the guest. + * + * @param username the username value to set. + * @return the GuestCredential object itself. + */ + public GuestCredential withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The password to connect with the guest. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password to connect with the guest. + * + * @param password the password value to set. + * @return the GuestCredential object itself. + */ + public GuestCredential withPassword(String password) { + this.password = password; + 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("username", this.username); + jsonWriter.writeStringField("password", this.password); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GuestCredential from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GuestCredential 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 GuestCredential. + */ + public static GuestCredential fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GuestCredential deserializedGuestCredential = new GuestCredential(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("username".equals(fieldName)) { + deserializedGuestCredential.username = reader.getString(); + } else if ("password".equals(fieldName)) { + deserializedGuestCredential.password = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedGuestCredential; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HardwareProfileUpdate.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HardwareProfileUpdate.java new file mode 100644 index 000000000000..b0be3fab50d9 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HardwareProfileUpdate.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * HardwareProfile - Specifies the hardware settings for the virtual machine instance. + */ +@Fluent +public final class HardwareProfileUpdate implements JsonSerializable { + /* + * VM Size Enum + */ + private VmSizeEnum vmSize; + + /* + * number of processors for the virtual machine instance + */ + private Integer processors; + + /* + * RAM in MB for the virtual machine instance + */ + private Long memoryMB; + + /* + * virtualMachineGPUs - updated list of GPUs on the virtual machine instance + */ + private List virtualMachineGPUs; + + /** + * Creates an instance of HardwareProfileUpdate class. + */ + public HardwareProfileUpdate() { + } + + /** + * Get the vmSize property: VM Size Enum. + * + * @return the vmSize value. + */ + public VmSizeEnum vmSize() { + return this.vmSize; + } + + /** + * Set the vmSize property: VM Size Enum. + * + * @param vmSize the vmSize value to set. + * @return the HardwareProfileUpdate object itself. + */ + public HardwareProfileUpdate withVmSize(VmSizeEnum vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get the processors property: number of processors for the virtual machine instance. + * + * @return the processors value. + */ + public Integer processors() { + return this.processors; + } + + /** + * Set the processors property: number of processors for the virtual machine instance. + * + * @param processors the processors value to set. + * @return the HardwareProfileUpdate object itself. + */ + public HardwareProfileUpdate withProcessors(Integer processors) { + this.processors = processors; + return this; + } + + /** + * Get the memoryMB property: RAM in MB for the virtual machine instance. + * + * @return the memoryMB value. + */ + public Long memoryMB() { + return this.memoryMB; + } + + /** + * Set the memoryMB property: RAM in MB for the virtual machine instance. + * + * @param memoryMB the memoryMB value to set. + * @return the HardwareProfileUpdate object itself. + */ + public HardwareProfileUpdate withMemoryMB(Long memoryMB) { + this.memoryMB = memoryMB; + return this; + } + + /** + * Get the virtualMachineGPUs property: virtualMachineGPUs - updated list of GPUs on the virtual machine instance. + * + * @return the virtualMachineGPUs value. + */ + public List virtualMachineGPUs() { + return this.virtualMachineGPUs; + } + + /** + * Set the virtualMachineGPUs property: virtualMachineGPUs - updated list of GPUs on the virtual machine instance. + * + * @param virtualMachineGPUs the virtualMachineGPUs value to set. + * @return the HardwareProfileUpdate object itself. + */ + public HardwareProfileUpdate withVirtualMachineGPUs( + List virtualMachineGPUs) { + this.virtualMachineGPUs = virtualMachineGPUs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (virtualMachineGPUs() != null) { + virtualMachineGPUs().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("vmSize", this.vmSize == null ? null : this.vmSize.toString()); + jsonWriter.writeNumberField("processors", this.processors); + jsonWriter.writeNumberField("memoryMB", this.memoryMB); + jsonWriter.writeArrayField("virtualMachineGPUs", this.virtualMachineGPUs, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HardwareProfileUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HardwareProfileUpdate 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 HardwareProfileUpdate. + */ + public static HardwareProfileUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HardwareProfileUpdate deserializedHardwareProfileUpdate = new HardwareProfileUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vmSize".equals(fieldName)) { + deserializedHardwareProfileUpdate.vmSize = VmSizeEnum.fromString(reader.getString()); + } else if ("processors".equals(fieldName)) { + deserializedHardwareProfileUpdate.processors = reader.getNullable(JsonReader::getInt); + } else if ("memoryMB".equals(fieldName)) { + deserializedHardwareProfileUpdate.memoryMB = reader.getNullable(JsonReader::getLong); + } else if ("virtualMachineGPUs".equals(fieldName)) { + List virtualMachineGPUs + = reader.readArray(reader1 -> VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU + .fromJson(reader1)); + deserializedHardwareProfileUpdate.virtualMachineGPUs = virtualMachineGPUs; + } else { + reader.skipChildren(); + } + } + + return deserializedHardwareProfileUpdate; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HttpProxyConfiguration.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HttpProxyConfiguration.java new file mode 100644 index 000000000000..320734d07984 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HttpProxyConfiguration.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * HTTP Proxy configuration for the VM. + */ +@Fluent +public final class HttpProxyConfiguration implements JsonSerializable { + /* + * The HTTP proxy server endpoint to use. + */ + private String httpProxy; + + /* + * The HTTPS proxy server endpoint to use. + */ + private String httpsProxy; + + /* + * The endpoints that should not go through proxy. + */ + private List noProxy; + + /* + * Alternative CA cert to use for connecting to proxy servers. + */ + private String trustedCa; + + /** + * Creates an instance of HttpProxyConfiguration class. + */ + public HttpProxyConfiguration() { + } + + /** + * Get the httpProxy property: The HTTP proxy server endpoint to use. + * + * @return the httpProxy value. + */ + public String httpProxy() { + return this.httpProxy; + } + + /** + * Set the httpProxy property: The HTTP proxy server endpoint to use. + * + * @param httpProxy the httpProxy value to set. + * @return the HttpProxyConfiguration object itself. + */ + public HttpProxyConfiguration withHttpProxy(String httpProxy) { + this.httpProxy = httpProxy; + return this; + } + + /** + * Get the httpsProxy property: The HTTPS proxy server endpoint to use. + * + * @return the httpsProxy value. + */ + public String httpsProxy() { + return this.httpsProxy; + } + + /** + * Set the httpsProxy property: The HTTPS proxy server endpoint to use. + * + * @param httpsProxy the httpsProxy value to set. + * @return the HttpProxyConfiguration object itself. + */ + public HttpProxyConfiguration withHttpsProxy(String httpsProxy) { + this.httpsProxy = httpsProxy; + return this; + } + + /** + * Get the noProxy property: The endpoints that should not go through proxy. + * + * @return the noProxy value. + */ + public List noProxy() { + return this.noProxy; + } + + /** + * Set the noProxy property: The endpoints that should not go through proxy. + * + * @param noProxy the noProxy value to set. + * @return the HttpProxyConfiguration object itself. + */ + public HttpProxyConfiguration withNoProxy(List noProxy) { + this.noProxy = noProxy; + return this; + } + + /** + * Get the trustedCa property: Alternative CA cert to use for connecting to proxy servers. + * + * @return the trustedCa value. + */ + public String trustedCa() { + return this.trustedCa; + } + + /** + * Set the trustedCa property: Alternative CA cert to use for connecting to proxy servers. + * + * @param trustedCa the trustedCa value to set. + * @return the HttpProxyConfiguration object itself. + */ + public HttpProxyConfiguration withTrustedCa(String trustedCa) { + this.trustedCa = trustedCa; + 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("httpProxy", this.httpProxy); + jsonWriter.writeStringField("httpsProxy", this.httpsProxy); + jsonWriter.writeArrayField("noProxy", this.noProxy, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("trustedCa", this.trustedCa); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HttpProxyConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HttpProxyConfiguration 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 HttpProxyConfiguration. + */ + public static HttpProxyConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HttpProxyConfiguration deserializedHttpProxyConfiguration = new HttpProxyConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("httpProxy".equals(fieldName)) { + deserializedHttpProxyConfiguration.httpProxy = reader.getString(); + } else if ("httpsProxy".equals(fieldName)) { + deserializedHttpProxyConfiguration.httpsProxy = reader.getString(); + } else if ("noProxy".equals(fieldName)) { + List noProxy = reader.readArray(reader1 -> reader1.getString()); + deserializedHttpProxyConfiguration.noProxy = noProxy; + } else if ("trustedCa".equals(fieldName)) { + deserializedHttpProxyConfiguration.trustedCa = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedHttpProxyConfiguration; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HybridIdentityMetadata.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HybridIdentityMetadata.java new file mode 100644 index 000000000000..92f0a980df6c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HybridIdentityMetadata.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.HybridIdentityMetadataInner; + +/** + * An immutable client-side representation of HybridIdentityMetadata. + */ +public interface HybridIdentityMetadata { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + HybridIdentityMetadataProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.HybridIdentityMetadataInner object. + * + * @return the inner object. + */ + HybridIdentityMetadataInner innerModel(); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HybridIdentityMetadataProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HybridIdentityMetadataProperties.java new file mode 100644 index 000000000000..2143c20c7cd7 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HybridIdentityMetadataProperties.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Defines the resource properties. + */ +@Immutable +public final class HybridIdentityMetadataProperties implements JsonSerializable { + /* + * The unique identifier for the resource. + */ + private String resourceUid; + + /* + * The Public Key. + */ + private String publicKey; + + /* + * Identity for the resource. + */ + private Identity identity; + + /* + * Provisioning state of the virtual machine instance. + */ + private ProvisioningStateEnum provisioningState; + + /** + * Creates an instance of HybridIdentityMetadataProperties class. + */ + private HybridIdentityMetadataProperties() { + } + + /** + * Get the resourceUid property: The unique identifier for the resource. + * + * @return the resourceUid value. + */ + public String resourceUid() { + return this.resourceUid; + } + + /** + * Get the publicKey property: The Public Key. + * + * @return the publicKey value. + */ + public String publicKey() { + return this.publicKey; + } + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Get the provisioningState property: Provisioning state of the virtual machine instance. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("resourceUid", this.resourceUid); + jsonWriter.writeStringField("publicKey", this.publicKey); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of HybridIdentityMetadataProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of HybridIdentityMetadataProperties 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 HybridIdentityMetadataProperties. + */ + public static HybridIdentityMetadataProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + HybridIdentityMetadataProperties deserializedHybridIdentityMetadataProperties + = new HybridIdentityMetadataProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("resourceUid".equals(fieldName)) { + deserializedHybridIdentityMetadataProperties.resourceUid = reader.getString(); + } else if ("publicKey".equals(fieldName)) { + deserializedHybridIdentityMetadataProperties.publicKey = reader.getString(); + } else if ("identity".equals(fieldName)) { + deserializedHybridIdentityMetadataProperties.identity = Identity.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedHybridIdentityMetadataProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedHybridIdentityMetadataProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HybridIdentityMetadatas.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HybridIdentityMetadatas.java new file mode 100644 index 000000000000..bf4e4a43ca0e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HybridIdentityMetadatas.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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 HybridIdentityMetadatas. + */ +public interface HybridIdentityMetadatas { + /** + * Implements HybridIdentityMetadata GET method. + * + * @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 defines the HybridIdentityMetadata along with {@link Response}. + */ + Response getWithResponse(String resourceUri, Context context); + + /** + * Implements HybridIdentityMetadata GET method. + * + * @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 defines the HybridIdentityMetadata. + */ + HybridIdentityMetadata get(String resourceUri); + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @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 HybridIdentityMetadata list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVirtualMachineInstance(String resourceUri); + + /** + * Returns the list of HybridIdentityMetadata of the given vm. + * + * @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 HybridIdentityMetadata list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByVirtualMachineInstance(String resourceUri, Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HyperVGeneration.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HyperVGeneration.java new file mode 100644 index 000000000000..55872560d037 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/HyperVGeneration.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The hypervisor generation of the Virtual Machine [V1, V2]. + */ +public final class HyperVGeneration extends ExpandableStringEnum { + /** + * Generation 1 (V1) hypervisor. + */ + public static final HyperVGeneration V1 = fromString("V1"); + + /** + * Generation 2 (V2) hypervisor. + */ + public static final HyperVGeneration V2 = fromString("V2"); + + /** + * Creates a new instance of HyperVGeneration value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public HyperVGeneration() { + } + + /** + * Creates or finds a HyperVGeneration from its string representation. + * + * @param name a name to look for. + * @return the corresponding HyperVGeneration. + */ + public static HyperVGeneration fromString(String name) { + return fromString(name, HyperVGeneration.class); + } + + /** + * Gets known HyperVGeneration values. + * + * @return known HyperVGeneration values. + */ + public static Collection values() { + return values(HyperVGeneration.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPConfiguration.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPConfiguration.java new file mode 100644 index 000000000000..29fccd06959d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPConfiguration.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * InterfaceIPConfiguration IPConfiguration in a network interface. + */ +@Fluent +public final class IPConfiguration implements JsonSerializable { + /* + * Name - The name of the resource that is unique within a resource group. This name can be used to access the + * resource. + */ + private String name; + + /* + * InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + */ + private IPConfigurationProperties properties; + + /** + * Creates an instance of IPConfiguration class. + */ + public IPConfiguration() { + } + + /** + * Get the name property: Name - The name of the resource that is unique within a resource group. This name can be + * used to access the resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name - The name of the resource that is unique within a resource group. This name can be + * used to access the resource. + * + * @param name the name value to set. + * @return the IPConfiguration object itself. + */ + public IPConfiguration withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties property: InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + * + * @return the properties value. + */ + public IPConfigurationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + * + * @param properties the properties value to set. + * @return the IPConfiguration object itself. + */ + public IPConfiguration withProperties(IPConfigurationProperties 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.writeStringField("name", this.name); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IPConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IPConfiguration 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 IPConfiguration. + */ + public static IPConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IPConfiguration deserializedIPConfiguration = new IPConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedIPConfiguration.name = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedIPConfiguration.properties = IPConfigurationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIPConfiguration; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPConfigurationProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPConfigurationProperties.java new file mode 100644 index 000000000000..8948f63cc9f9 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPConfigurationProperties.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * InterfaceIPConfigurationPropertiesFormat properties of IP configuration. + */ +@Fluent +public final class IPConfigurationProperties implements JsonSerializable { + /* + * Gateway for network interface + */ + private String gateway; + + /* + * prefixLength for network interface + */ + private String prefixLength; + + /* + * PrivateIPAddress - Private IP address of the IP configuration. + */ + private String privateIPAddress; + + /* + * Subnet - Name of Subnet bound to the IP configuration. + */ + private LogicalNetworkArmReference subnet; + + /** + * Creates an instance of IPConfigurationProperties class. + */ + public IPConfigurationProperties() { + } + + /** + * Get the gateway property: Gateway for network interface. + * + * @return the gateway value. + */ + public String gateway() { + return this.gateway; + } + + /** + * Get the prefixLength property: prefixLength for network interface. + * + * @return the prefixLength value. + */ + public String prefixLength() { + return this.prefixLength; + } + + /** + * Get the privateIPAddress property: PrivateIPAddress - Private IP address of the IP configuration. + * + * @return the privateIPAddress value. + */ + public String privateIPAddress() { + return this.privateIPAddress; + } + + /** + * Set the privateIPAddress property: PrivateIPAddress - Private IP address of the IP configuration. + * + * @param privateIPAddress the privateIPAddress value to set. + * @return the IPConfigurationProperties object itself. + */ + public IPConfigurationProperties withPrivateIPAddress(String privateIPAddress) { + this.privateIPAddress = privateIPAddress; + return this; + } + + /** + * Get the subnet property: Subnet - Name of Subnet bound to the IP configuration. + * + * @return the subnet value. + */ + public LogicalNetworkArmReference subnet() { + return this.subnet; + } + + /** + * Set the subnet property: Subnet - Name of Subnet bound to the IP configuration. + * + * @param subnet the subnet value to set. + * @return the IPConfigurationProperties object itself. + */ + public IPConfigurationProperties withSubnet(LogicalNetworkArmReference subnet) { + this.subnet = subnet; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subnet() != null) { + subnet().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("privateIPAddress", this.privateIPAddress); + jsonWriter.writeJsonField("subnet", this.subnet); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IPConfigurationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IPConfigurationProperties 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 IPConfigurationProperties. + */ + public static IPConfigurationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IPConfigurationProperties deserializedIPConfigurationProperties = new IPConfigurationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("gateway".equals(fieldName)) { + deserializedIPConfigurationProperties.gateway = reader.getString(); + } else if ("prefixLength".equals(fieldName)) { + deserializedIPConfigurationProperties.prefixLength = reader.getString(); + } else if ("privateIPAddress".equals(fieldName)) { + deserializedIPConfigurationProperties.privateIPAddress = reader.getString(); + } else if ("subnet".equals(fieldName)) { + deserializedIPConfigurationProperties.subnet = LogicalNetworkArmReference.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIPConfigurationProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPPool.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPPool.java new file mode 100644 index 000000000000..dac56bdd6fff --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPPool.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Describes IPPool. + */ +@Fluent +public final class IPPool implements JsonSerializable { + /* + * Name of the IP-Pool + */ + private String name; + + /* + * Type of the IP Pool [vm, vippool] + */ + private IPPoolTypeEnum ipPoolType; + + /* + * Start of the IP address pool + */ + private String start; + + /* + * End of the IP address pool + */ + private String end; + + /* + * IPPool info + */ + private IPPoolInfo info; + + /** + * Creates an instance of IPPool class. + */ + public IPPool() { + } + + /** + * Get the name property: Name of the IP-Pool. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the IP-Pool. + * + * @param name the name value to set. + * @return the IPPool object itself. + */ + public IPPool withName(String name) { + this.name = name; + return this; + } + + /** + * Get the ipPoolType property: Type of the IP Pool [vm, vippool]. + * + * @return the ipPoolType value. + */ + public IPPoolTypeEnum ipPoolType() { + return this.ipPoolType; + } + + /** + * Set the ipPoolType property: Type of the IP Pool [vm, vippool]. + * + * @param ipPoolType the ipPoolType value to set. + * @return the IPPool object itself. + */ + public IPPool withIpPoolType(IPPoolTypeEnum ipPoolType) { + this.ipPoolType = ipPoolType; + return this; + } + + /** + * Get the start property: Start of the IP address pool. + * + * @return the start value. + */ + public String start() { + return this.start; + } + + /** + * Set the start property: Start of the IP address pool. + * + * @param start the start value to set. + * @return the IPPool object itself. + */ + public IPPool withStart(String start) { + this.start = start; + return this; + } + + /** + * Get the end property: End of the IP address pool. + * + * @return the end value. + */ + public String end() { + return this.end; + } + + /** + * Set the end property: End of the IP address pool. + * + * @param end the end value to set. + * @return the IPPool object itself. + */ + public IPPool withEnd(String end) { + this.end = end; + return this; + } + + /** + * Get the info property: IPPool info. + * + * @return the info value. + */ + public IPPoolInfo info() { + return this.info; + } + + /** + * Set the info property: IPPool info. + * + * @param info the info value to set. + * @return the IPPool object itself. + */ + public IPPool withInfo(IPPoolInfo info) { + this.info = info; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (info() != null) { + info().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("ipPoolType", this.ipPoolType == null ? null : this.ipPoolType.toString()); + jsonWriter.writeStringField("start", this.start); + jsonWriter.writeStringField("end", this.end); + jsonWriter.writeJsonField("info", this.info); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IPPool from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IPPool 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 IPPool. + */ + public static IPPool fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IPPool deserializedIPPool = new IPPool(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedIPPool.name = reader.getString(); + } else if ("ipPoolType".equals(fieldName)) { + deserializedIPPool.ipPoolType = IPPoolTypeEnum.fromString(reader.getString()); + } else if ("start".equals(fieldName)) { + deserializedIPPool.start = reader.getString(); + } else if ("end".equals(fieldName)) { + deserializedIPPool.end = reader.getString(); + } else if ("info".equals(fieldName)) { + deserializedIPPool.info = IPPoolInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIPPool; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPPoolInfo.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPPoolInfo.java new file mode 100644 index 000000000000..ef49ddb43fec --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPPoolInfo.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * IP Pool info. + */ +@Immutable +public final class IPPoolInfo implements JsonSerializable { + /* + * Number of IP addresses allocated from the IP Pool + */ + private String used; + + /* + * Number of IP addresses available in the IP Pool + */ + private String available; + + /** + * Creates an instance of IPPoolInfo class. + */ + public IPPoolInfo() { + } + + /** + * Get the used property: Number of IP addresses allocated from the IP Pool. + * + * @return the used value. + */ + public String used() { + return this.used; + } + + /** + * Get the available property: Number of IP addresses available in the IP Pool. + * + * @return the available value. + */ + public String available() { + return this.available; + } + + /** + * 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 IPPoolInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IPPoolInfo 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 IPPoolInfo. + */ + public static IPPoolInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IPPoolInfo deserializedIPPoolInfo = new IPPoolInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("used".equals(fieldName)) { + deserializedIPPoolInfo.used = reader.getString(); + } else if ("available".equals(fieldName)) { + deserializedIPPoolInfo.available = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIPPoolInfo; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPPoolTypeEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPPoolTypeEnum.java new file mode 100644 index 000000000000..33ef239d20e1 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IPPoolTypeEnum.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of the IP Pool [vm, vippool]. + */ +public final class IPPoolTypeEnum extends ExpandableStringEnum { + /** + * Virtual Machine IP Pool. + */ + public static final IPPoolTypeEnum VM = fromString("vm"); + + /** + * VIP Pool. + */ + public static final IPPoolTypeEnum VIPPOOL = fromString("vippool"); + + /** + * Creates a new instance of IPPoolTypeEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IPPoolTypeEnum() { + } + + /** + * Creates or finds a IPPoolTypeEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding IPPoolTypeEnum. + */ + public static IPPoolTypeEnum fromString(String name) { + return fromString(name, IPPoolTypeEnum.class); + } + + /** + * Gets known IPPoolTypeEnum values. + * + * @return known IPPoolTypeEnum values. + */ + public static Collection values() { + return values(IPPoolTypeEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Identity.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Identity.java new file mode 100644 index 000000000000..70b43fcfef89 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Identity.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Identity for the resource. + */ +@Fluent +public final class Identity implements JsonSerializable { + /* + * The principal ID of resource identity. The value must be an UUID. + */ + private String principalId; + + /* + * The tenant ID of resource. The value must be an UUID. + */ + private String tenantId; + + /* + * The identity type. + */ + private IdentityType type; + + /** + * Creates an instance of Identity class. + */ + public Identity() { + } + + /** + * Get the principalId property: The principal ID of resource identity. The value must be an UUID. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. The value must be an UUID. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(IdentityType type) { + this.type = type; + 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("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Identity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Identity 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 Identity. + */ + public static Identity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Identity deserializedIdentity = new Identity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedIdentity.tenantId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIdentity.type = IdentityType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedIdentity; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IdentityType.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IdentityType.java new file mode 100644 index 000000000000..bac110bff43f --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IdentityType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +/** + * Defines values for IdentityType. + */ +public enum IdentityType { + /** + * Enum value SystemAssigned. + */ + SYSTEM_ASSIGNED("SystemAssigned"); + + /** + * The actual serialized value for a IdentityType instance. + */ + private final String value; + + IdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed IdentityType object, or null if unable to parse. + */ + public static IdentityType fromString(String value) { + if (value == null) { + return null; + } + IdentityType[] items = IdentityType.values(); + for (IdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ImageArmReference.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ImageArmReference.java new file mode 100644 index 000000000000..e75422108e01 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ImageArmReference.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The ARM ID for a Gallery Image. + */ +@Fluent +public final class ImageArmReference implements JsonSerializable { + /* + * The ARM ID for an image resource used by the virtual machine instance. + */ + private String id; + + /** + * Creates an instance of ImageArmReference class. + */ + public ImageArmReference() { + } + + /** + * Get the id property: The ARM ID for an image resource used by the virtual machine instance. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM ID for an image resource used by the virtual machine instance. + * + * @param id the id value to set. + * @return the ImageArmReference object itself. + */ + public ImageArmReference withId(String id) { + this.id = id; + 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("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImageArmReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImageArmReference 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 ImageArmReference. + */ + public static ImageArmReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImageArmReference deserializedImageArmReference = new ImageArmReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedImageArmReference.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedImageArmReference; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/InstanceViewStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/InstanceViewStatus.java new file mode 100644 index 000000000000..de11f14e331c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/InstanceViewStatus.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.annotation.Immutable; +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; + +/** + * Instance view status. + */ +@Immutable +public final class InstanceViewStatus implements JsonSerializable { + /* + * The status code. + */ + private String code; + + /* + * The level code. + */ + private StatusLevelTypes level; + + /* + * The short localizable label for the status. + */ + private String displayStatus; + + /* + * The detailed status message, including for alerts and error messages. + */ + private String message; + + /* + * The time of the status. + */ + private OffsetDateTime time; + + /** + * Creates an instance of InstanceViewStatus class. + */ + private InstanceViewStatus() { + } + + /** + * Get the code property: The status code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the level property: The level code. + * + * @return the level value. + */ + public StatusLevelTypes level() { + return this.level; + } + + /** + * Get the displayStatus property: The short localizable label for the status. + * + * @return the displayStatus value. + */ + public String displayStatus() { + return this.displayStatus; + } + + /** + * Get the message property: The detailed status message, including for alerts and error messages. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the time property: The time of the status. + * + * @return the time value. + */ + public OffsetDateTime time() { + return this.time; + } + + /** + * 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("code", this.code); + jsonWriter.writeStringField("level", this.level == null ? null : this.level.toString()); + jsonWriter.writeStringField("displayStatus", this.displayStatus); + jsonWriter.writeStringField("message", this.message); + jsonWriter.writeStringField("time", + this.time == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.time)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InstanceViewStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InstanceViewStatus 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 InstanceViewStatus. + */ + public static InstanceViewStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InstanceViewStatus deserializedInstanceViewStatus = new InstanceViewStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedInstanceViewStatus.code = reader.getString(); + } else if ("level".equals(fieldName)) { + deserializedInstanceViewStatus.level = StatusLevelTypes.fromString(reader.getString()); + } else if ("displayStatus".equals(fieldName)) { + deserializedInstanceViewStatus.displayStatus = reader.getString(); + } else if ("message".equals(fieldName)) { + deserializedInstanceViewStatus.message = reader.getString(); + } else if ("time".equals(fieldName)) { + deserializedInstanceViewStatus.time = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedInstanceViewStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/InterfaceDNSSettings.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/InterfaceDNSSettings.java new file mode 100644 index 000000000000..56526c5e2264 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/InterfaceDNSSettings.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * DNS Settings of the interface. + */ +@Fluent +public final class InterfaceDNSSettings implements JsonSerializable { + /* + * List of DNS server IP Addresses for the interface + */ + private List dnsServers; + + /** + * Creates an instance of InterfaceDNSSettings class. + */ + public InterfaceDNSSettings() { + } + + /** + * Get the dnsServers property: List of DNS server IP Addresses for the interface. + * + * @return the dnsServers value. + */ + public List dnsServers() { + return this.dnsServers; + } + + /** + * Set the dnsServers property: List of DNS server IP Addresses for the interface. + * + * @param dnsServers the dnsServers value to set. + * @return the InterfaceDNSSettings object itself. + */ + public InterfaceDNSSettings withDnsServers(List dnsServers) { + this.dnsServers = dnsServers; + 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("dnsServers", this.dnsServers, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InterfaceDNSSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InterfaceDNSSettings 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 InterfaceDNSSettings. + */ + public static InterfaceDNSSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InterfaceDNSSettings deserializedInterfaceDNSSettings = new InterfaceDNSSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dnsServers".equals(fieldName)) { + List dnsServers = reader.readArray(reader1 -> reader1.getString()); + deserializedInterfaceDNSSettings.dnsServers = dnsServers; + } else { + reader.skipChildren(); + } + } + + return deserializedInterfaceDNSSettings; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IpAllocationMethodEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IpAllocationMethodEnum.java new file mode 100644 index 000000000000..8f9c9d43f0b4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/IpAllocationMethodEnum.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * IPAllocationMethod - The IP address allocation method. Possible values include: 'Static', 'Dynamic'. + */ +public final class IpAllocationMethodEnum extends ExpandableStringEnum { + /** + * Dynamic IP allocation method. + */ + public static final IpAllocationMethodEnum DYNAMIC = fromString("Dynamic"); + + /** + * Static IP allocation method. + */ + public static final IpAllocationMethodEnum STATIC = fromString("Static"); + + /** + * Creates a new instance of IpAllocationMethodEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IpAllocationMethodEnum() { + } + + /** + * Creates or finds a IpAllocationMethodEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding IpAllocationMethodEnum. + */ + public static IpAllocationMethodEnum fromString(String name) { + return fromString(name, IpAllocationMethodEnum.class); + } + + /** + * Gets known IpAllocationMethodEnum values. + * + * @return known IpAllocationMethodEnum values. + */ + public static Collection values() { + return values(IpAllocationMethodEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetwork.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetwork.java new file mode 100644 index 000000000000..cacf52fba660 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetwork.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.LogicalNetworkInner; +import java.util.Map; + +/** + * An immutable client-side representation of LogicalNetwork. + */ +public interface LogicalNetwork { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + LogicalNetworkProperties properties(); + + /** + * Gets the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.LogicalNetworkInner object. + * + * @return the inner object. + */ + LogicalNetworkInner innerModel(); + + /** + * The entirety of the LogicalNetwork definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The LogicalNetwork definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the LogicalNetwork definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the LogicalNetwork 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 LogicalNetwork 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 LogicalNetwork definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithExtendedLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + LogicalNetwork create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LogicalNetwork create(Context context); + } + + /** + * The stage of the LogicalNetwork 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 LogicalNetwork definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(LogicalNetworkProperties properties); + } + + /** + * The stage of the LogicalNetwork definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extendedLocation of the resource.. + * + * @param extendedLocation The extendedLocation of the resource. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + } + + /** + * Begins update for the LogicalNetwork resource. + * + * @return the stage of resource update. + */ + LogicalNetwork.Update update(); + + /** + * The template for LogicalNetwork update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LogicalNetwork apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LogicalNetwork apply(Context context); + } + + /** + * The LogicalNetwork update stages. + */ + interface UpdateStages { + /** + * The stage of the LogicalNetwork 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); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LogicalNetwork refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LogicalNetwork refresh(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkArmReference.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkArmReference.java new file mode 100644 index 000000000000..76f0d5954337 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkArmReference.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The ARM ID for a Logical Network. + */ +@Fluent +public final class LogicalNetworkArmReference implements JsonSerializable { + /* + * The ARM ID for a Logical Network. + */ + private String id; + + /** + * Creates an instance of LogicalNetworkArmReference class. + */ + public LogicalNetworkArmReference() { + } + + /** + * Get the id property: The ARM ID for a Logical Network. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM ID for a Logical Network. + * + * @param id the id value to set. + * @return the LogicalNetworkArmReference object itself. + */ + public LogicalNetworkArmReference withId(String id) { + this.id = id; + 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("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogicalNetworkArmReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogicalNetworkArmReference 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 LogicalNetworkArmReference. + */ + public static LogicalNetworkArmReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogicalNetworkArmReference deserializedLogicalNetworkArmReference = new LogicalNetworkArmReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedLogicalNetworkArmReference.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLogicalNetworkArmReference; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkProperties.java new file mode 100644 index 000000000000..8680d86b151b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkProperties.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Properties under the logical network resource. + */ +@Fluent +public final class LogicalNetworkProperties implements JsonSerializable { + /* + * DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP + * option for a subnet overrides logical network DHCP options. + */ + private LogicalNetworkPropertiesDhcpOptions dhcpOptions; + + /* + * Subnet - list of subnets under the logical network + */ + private List subnets; + + /* + * Provisioning state of the logical network. + */ + private ProvisioningStateEnum provisioningState; + + /* + * name of the network switch to be used for VMs + */ + private String vmSwitchName; + + /* + * The observed state of logical networks + */ + private LogicalNetworkStatus status; + + /* + * Type of the Logical Network + */ + private LogicalNetworkTypeEnum networkType; + + /** + * Creates an instance of LogicalNetworkProperties class. + */ + public LogicalNetworkProperties() { + } + + /** + * Get the dhcpOptions property: DhcpOptions contains an array of DNS servers available to VMs deployed in the + * logical network. Standard DHCP option for a subnet overrides logical network DHCP options. + * + * @return the dhcpOptions value. + */ + public LogicalNetworkPropertiesDhcpOptions dhcpOptions() { + return this.dhcpOptions; + } + + /** + * Set the dhcpOptions property: DhcpOptions contains an array of DNS servers available to VMs deployed in the + * logical network. Standard DHCP option for a subnet overrides logical network DHCP options. + * + * @param dhcpOptions the dhcpOptions value to set. + * @return the LogicalNetworkProperties object itself. + */ + public LogicalNetworkProperties withDhcpOptions(LogicalNetworkPropertiesDhcpOptions dhcpOptions) { + this.dhcpOptions = dhcpOptions; + return this; + } + + /** + * Get the subnets property: Subnet - list of subnets under the logical network. + * + * @return the subnets value. + */ + public List subnets() { + return this.subnets; + } + + /** + * Set the subnets property: Subnet - list of subnets under the logical network. + * + * @param subnets the subnets value to set. + * @return the LogicalNetworkProperties object itself. + */ + public LogicalNetworkProperties withSubnets(List subnets) { + this.subnets = subnets; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the logical network. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Get the vmSwitchName property: name of the network switch to be used for VMs. + * + * @return the vmSwitchName value. + */ + public String vmSwitchName() { + return this.vmSwitchName; + } + + /** + * Set the vmSwitchName property: name of the network switch to be used for VMs. + * + * @param vmSwitchName the vmSwitchName value to set. + * @return the LogicalNetworkProperties object itself. + */ + public LogicalNetworkProperties withVmSwitchName(String vmSwitchName) { + this.vmSwitchName = vmSwitchName; + return this; + } + + /** + * Get the status property: The observed state of logical networks. + * + * @return the status value. + */ + public LogicalNetworkStatus status() { + return this.status; + } + + /** + * Get the networkType property: Type of the Logical Network. + * + * @return the networkType value. + */ + public LogicalNetworkTypeEnum networkType() { + return this.networkType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dhcpOptions() != null) { + dhcpOptions().validate(); + } + if (subnets() != null) { + subnets().forEach(e -> e.validate()); + } + if (status() != null) { + status().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("dhcpOptions", this.dhcpOptions); + jsonWriter.writeArrayField("subnets", this.subnets, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("vmSwitchName", this.vmSwitchName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogicalNetworkProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogicalNetworkProperties 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 LogicalNetworkProperties. + */ + public static LogicalNetworkProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogicalNetworkProperties deserializedLogicalNetworkProperties = new LogicalNetworkProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dhcpOptions".equals(fieldName)) { + deserializedLogicalNetworkProperties.dhcpOptions + = LogicalNetworkPropertiesDhcpOptions.fromJson(reader); + } else if ("subnets".equals(fieldName)) { + List subnets = reader.readArray(reader1 -> Subnet.fromJson(reader1)); + deserializedLogicalNetworkProperties.subnets = subnets; + } else if ("provisioningState".equals(fieldName)) { + deserializedLogicalNetworkProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else if ("vmSwitchName".equals(fieldName)) { + deserializedLogicalNetworkProperties.vmSwitchName = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedLogicalNetworkProperties.status = LogicalNetworkStatus.fromJson(reader); + } else if ("networkType".equals(fieldName)) { + deserializedLogicalNetworkProperties.networkType + = LogicalNetworkTypeEnum.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedLogicalNetworkProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkPropertiesDhcpOptions.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkPropertiesDhcpOptions.java new file mode 100644 index 000000000000..0e2a03f5e6f6 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkPropertiesDhcpOptions.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * DhcpOptions contains an array of DNS servers available to VMs deployed in the logical network. Standard DHCP option + * for a subnet overrides logical network DHCP options. + */ +@Fluent +public final class LogicalNetworkPropertiesDhcpOptions + implements JsonSerializable { + /* + * The list of DNS servers IP addresses. + */ + private List dnsServers; + + /** + * Creates an instance of LogicalNetworkPropertiesDhcpOptions class. + */ + public LogicalNetworkPropertiesDhcpOptions() { + } + + /** + * Get the dnsServers property: The list of DNS servers IP addresses. + * + * @return the dnsServers value. + */ + public List dnsServers() { + return this.dnsServers; + } + + /** + * Set the dnsServers property: The list of DNS servers IP addresses. + * + * @param dnsServers the dnsServers value to set. + * @return the LogicalNetworkPropertiesDhcpOptions object itself. + */ + public LogicalNetworkPropertiesDhcpOptions withDnsServers(List dnsServers) { + this.dnsServers = dnsServers; + 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("dnsServers", this.dnsServers, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogicalNetworkPropertiesDhcpOptions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogicalNetworkPropertiesDhcpOptions 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 LogicalNetworkPropertiesDhcpOptions. + */ + public static LogicalNetworkPropertiesDhcpOptions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogicalNetworkPropertiesDhcpOptions deserializedLogicalNetworkPropertiesDhcpOptions + = new LogicalNetworkPropertiesDhcpOptions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dnsServers".equals(fieldName)) { + List dnsServers = reader.readArray(reader1 -> reader1.getString()); + deserializedLogicalNetworkPropertiesDhcpOptions.dnsServers = dnsServers; + } else { + reader.skipChildren(); + } + } + + return deserializedLogicalNetworkPropertiesDhcpOptions; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkStatus.java new file mode 100644 index 000000000000..7552704b829a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkStatus.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The observed state of logical networks. + */ +@Immutable +public final class LogicalNetworkStatus implements JsonSerializable { + /* + * LogicalNetwork provisioning error code + */ + private String errorCode; + + /* + * Descriptive error message + */ + private String errorMessage; + + /* + * Logical network provisioning status + */ + private LogicalNetworkStatusProvisioningStatus provisioningStatus; + + /** + * Creates an instance of LogicalNetworkStatus class. + */ + private LogicalNetworkStatus() { + } + + /** + * Get the errorCode property: LogicalNetwork provisioning error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: Descriptive error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the provisioningStatus property: Logical network provisioning status. + * + * @return the provisioningStatus value. + */ + public LogicalNetworkStatusProvisioningStatus provisioningStatus() { + return this.provisioningStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provisioningStatus() != null) { + provisioningStatus().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeJsonField("provisioningStatus", this.provisioningStatus); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogicalNetworkStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogicalNetworkStatus 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 LogicalNetworkStatus. + */ + public static LogicalNetworkStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogicalNetworkStatus deserializedLogicalNetworkStatus = new LogicalNetworkStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedLogicalNetworkStatus.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedLogicalNetworkStatus.errorMessage = reader.getString(); + } else if ("provisioningStatus".equals(fieldName)) { + deserializedLogicalNetworkStatus.provisioningStatus + = LogicalNetworkStatusProvisioningStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLogicalNetworkStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkStatusProvisioningStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkStatusProvisioningStatus.java new file mode 100644 index 000000000000..b0c111842f4d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkStatusProvisioningStatus.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Describes the status of the provisioning. + */ +@Immutable +public final class LogicalNetworkStatusProvisioningStatus + implements JsonSerializable { + /* + * The ID of the operation performed on the logical network + */ + private String operationId; + + /* + * The status of the operation performed on the logical network [Succeeded, Failed, InProgress] + */ + private Status status; + + /** + * Creates an instance of LogicalNetworkStatusProvisioningStatus class. + */ + private LogicalNetworkStatusProvisioningStatus() { + } + + /** + * Get the operationId property: The ID of the operation performed on the logical network. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the status property: The status of the operation performed on the logical network [Succeeded, Failed, + * InProgress]. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * 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("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogicalNetworkStatusProvisioningStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogicalNetworkStatusProvisioningStatus 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 LogicalNetworkStatusProvisioningStatus. + */ + public static LogicalNetworkStatusProvisioningStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogicalNetworkStatusProvisioningStatus deserializedLogicalNetworkStatusProvisioningStatus + = new LogicalNetworkStatusProvisioningStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + deserializedLogicalNetworkStatusProvisioningStatus.operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedLogicalNetworkStatusProvisioningStatus.status = Status.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedLogicalNetworkStatusProvisioningStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkTypeEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkTypeEnum.java new file mode 100644 index 000000000000..17d99e368ea4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworkTypeEnum.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of Logical Network. + */ +public final class LogicalNetworkTypeEnum extends ExpandableStringEnum { + /** + * Logical Network of type Workload. + */ + public static final LogicalNetworkTypeEnum WORKLOAD = fromString("Workload"); + + /** + * Logical Network of type Infrastructure. + */ + public static final LogicalNetworkTypeEnum INFRASTRUCTURE = fromString("Infrastructure"); + + /** + * Creates a new instance of LogicalNetworkTypeEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LogicalNetworkTypeEnum() { + } + + /** + * Creates or finds a LogicalNetworkTypeEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding LogicalNetworkTypeEnum. + */ + public static LogicalNetworkTypeEnum fromString(String name) { + return fromString(name, LogicalNetworkTypeEnum.class); + } + + /** + * Gets known LogicalNetworkTypeEnum values. + * + * @return known LogicalNetworkTypeEnum values. + */ + public static Collection values() { + return values(LogicalNetworkTypeEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworks.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworks.java new file mode 100644 index 000000000000..88eaeba7deee --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworks.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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 LogicalNetworks. + */ +public interface LogicalNetworks { + /** + * The operation to get a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logical network resource definition along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String logicalNetworkName, + Context context); + + /** + * The operation to get a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logical network resource definition. + */ + LogicalNetwork getByResourceGroup(String resourceGroupName, String logicalNetworkName); + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 logicalNetworkName); + + /** + * The operation to delete a logical network. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param logicalNetworkName Name of the logical network. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 logicalNetworkName, Context context); + + /** + * Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to + * get the next page of logical networks. + * + * @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 LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the logical networks in the specified resource group. Use the nextLink property in the response to + * get the next page of logical networks. + * + * @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 LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get + * the next page of logical networks. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the logical networks in the specified subscription. Use the nextLink property in the response to get + * the next page of logical networks. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LogicalNetwork list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * The operation to get a logical network. + * + * @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 the logical network resource definition along with {@link Response}. + */ + LogicalNetwork getById(String id); + + /** + * The operation to get a logical network. + * + * @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 the logical network resource definition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The operation to delete a logical network. + * + * @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); + + /** + * The operation to delete a logical network. + * + * @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 LogicalNetwork resource. + * + * @param name resource name. + * @return the first stage of the new LogicalNetwork definition. + */ + LogicalNetwork.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworksUpdateRequest.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworksUpdateRequest.java new file mode 100644 index 000000000000..0595ce05625b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/LogicalNetworksUpdateRequest.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The logical network resource patch definition. + */ +@Fluent +public final class LogicalNetworksUpdateRequest implements JsonSerializable { + /* + * Resource tags + */ + private Map tags; + + /** + * Creates an instance of LogicalNetworksUpdateRequest class. + */ + public LogicalNetworksUpdateRequest() { + } + + /** + * 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 LogicalNetworksUpdateRequest object itself. + */ + public LogicalNetworksUpdateRequest withTags(Map tags) { + this.tags = tags; + 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.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogicalNetworksUpdateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogicalNetworksUpdateRequest 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 LogicalNetworksUpdateRequest. + */ + public static LogicalNetworksUpdateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogicalNetworksUpdateRequest deserializedLogicalNetworksUpdateRequest = new LogicalNetworksUpdateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedLogicalNetworksUpdateRequest.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedLogicalNetworksUpdateRequest; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ManagedServiceIdentity.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..9b58681641d0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ManagedServiceIdentity.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private String principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private String tenantId; + + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * 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.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId = reader.getString(); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ManagedServiceIdentityType.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..634a235cdc2e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * No managed identity. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * System assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * User assigned managed identity. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * System and user assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImage.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImage.java new file mode 100644 index 000000000000..0673bbb0e434 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImage.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.MarketplaceGalleryImageInner; +import java.util.Map; + +/** + * An immutable client-side representation of MarketplaceGalleryImage. + */ +public interface MarketplaceGalleryImage { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + MarketplaceGalleryImageProperties properties(); + + /** + * Gets the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.MarketplaceGalleryImageInner object. + * + * @return the inner object. + */ + MarketplaceGalleryImageInner innerModel(); + + /** + * The entirety of the MarketplaceGalleryImage definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The MarketplaceGalleryImage definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the MarketplaceGalleryImage definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the MarketplaceGalleryImage 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 MarketplaceGalleryImage 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 MarketplaceGalleryImage definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithExtendedLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + MarketplaceGalleryImage create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MarketplaceGalleryImage create(Context context); + } + + /** + * The stage of the MarketplaceGalleryImage 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 MarketplaceGalleryImage definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(MarketplaceGalleryImageProperties properties); + } + + /** + * The stage of the MarketplaceGalleryImage definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extendedLocation of the resource.. + * + * @param extendedLocation The extendedLocation of the resource. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + } + + /** + * Begins update for the MarketplaceGalleryImage resource. + * + * @return the stage of resource update. + */ + MarketplaceGalleryImage.Update update(); + + /** + * The template for MarketplaceGalleryImage update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MarketplaceGalleryImage apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MarketplaceGalleryImage apply(Context context); + } + + /** + * The MarketplaceGalleryImage update stages. + */ + interface UpdateStages { + /** + * The stage of the MarketplaceGalleryImage 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); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MarketplaceGalleryImage refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MarketplaceGalleryImage refresh(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageProperties.java new file mode 100644 index 000000000000..09153539b63b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageProperties.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Properties under the marketplace gallery image resource. + */ +@Fluent +public final class MarketplaceGalleryImageProperties implements JsonSerializable { + /* + * Storage ContainerID of the storage container to be used for marketplace gallery image + */ + private String containerId; + + /* + * Operating system type that the gallery image uses [Windows, Linux] + */ + private OperatingSystemTypes osType; + + /* + * Datasource for the gallery image when provisioning with cloud-init [NoCloud, Azure] + */ + private CloudInitDataSource cloudInitDataSource; + + /* + * The hypervisor generation of the Virtual Machine [V1, V2] + */ + private HyperVGeneration hyperVGeneration; + + /* + * This is the gallery image definition identifier. + */ + private GalleryImageIdentifier identifier; + + /* + * Specifies information about the gallery image version that you want to create or update. + */ + private GalleryImageVersion version; + + /* + * Provisioning state of the marketplace gallery image. + */ + private ProvisioningStateEnum provisioningState; + + /* + * The observed state of marketplace gallery images + */ + private MarketplaceGalleryImageStatus status; + + /** + * Creates an instance of MarketplaceGalleryImageProperties class. + */ + public MarketplaceGalleryImageProperties() { + } + + /** + * Get the containerId property: Storage ContainerID of the storage container to be used for marketplace gallery + * image. + * + * @return the containerId value. + */ + public String containerId() { + return this.containerId; + } + + /** + * Set the containerId property: Storage ContainerID of the storage container to be used for marketplace gallery + * image. + * + * @param containerId the containerId value to set. + * @return the MarketplaceGalleryImageProperties object itself. + */ + public MarketplaceGalleryImageProperties withContainerId(String containerId) { + this.containerId = containerId; + return this; + } + + /** + * Get the osType property: Operating system type that the gallery image uses [Windows, Linux]. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.osType; + } + + /** + * Set the osType property: Operating system type that the gallery image uses [Windows, Linux]. + * + * @param osType the osType value to set. + * @return the MarketplaceGalleryImageProperties object itself. + */ + public MarketplaceGalleryImageProperties withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the cloudInitDataSource property: Datasource for the gallery image when provisioning with cloud-init + * [NoCloud, Azure]. + * + * @return the cloudInitDataSource value. + */ + public CloudInitDataSource cloudInitDataSource() { + return this.cloudInitDataSource; + } + + /** + * Set the cloudInitDataSource property: Datasource for the gallery image when provisioning with cloud-init + * [NoCloud, Azure]. + * + * @param cloudInitDataSource the cloudInitDataSource value to set. + * @return the MarketplaceGalleryImageProperties object itself. + */ + public MarketplaceGalleryImageProperties withCloudInitDataSource(CloudInitDataSource cloudInitDataSource) { + this.cloudInitDataSource = cloudInitDataSource; + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine [V1, V2]. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine [V1, V2]. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the MarketplaceGalleryImageProperties object itself. + */ + public MarketplaceGalleryImageProperties withHyperVGeneration(HyperVGeneration hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Get the identifier property: This is the gallery image definition identifier. + * + * @return the identifier value. + */ + public GalleryImageIdentifier identifier() { + return this.identifier; + } + + /** + * Set the identifier property: This is the gallery image definition identifier. + * + * @param identifier the identifier value to set. + * @return the MarketplaceGalleryImageProperties object itself. + */ + public MarketplaceGalleryImageProperties withIdentifier(GalleryImageIdentifier identifier) { + this.identifier = identifier; + return this; + } + + /** + * Get the version property: Specifies information about the gallery image version that you want to create or + * update. + * + * @return the version value. + */ + public GalleryImageVersion version() { + return this.version; + } + + /** + * Set the version property: Specifies information about the gallery image version that you want to create or + * update. + * + * @param version the version value to set. + * @return the MarketplaceGalleryImageProperties object itself. + */ + public MarketplaceGalleryImageProperties withVersion(GalleryImageVersion version) { + this.version = version; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the marketplace gallery image. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Get the status property: The observed state of marketplace gallery images. + * + * @return the status value. + */ + public MarketplaceGalleryImageStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property osType in model MarketplaceGalleryImageProperties")); + } + if (identifier() != null) { + identifier().validate(); + } + if (version() != null) { + version().validate(); + } + if (status() != null) { + status().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MarketplaceGalleryImageProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("osType", this.osType == null ? null : this.osType.toString()); + jsonWriter.writeStringField("containerId", this.containerId); + jsonWriter.writeStringField("cloudInitDataSource", + this.cloudInitDataSource == null ? null : this.cloudInitDataSource.toString()); + jsonWriter.writeStringField("hyperVGeneration", + this.hyperVGeneration == null ? null : this.hyperVGeneration.toString()); + jsonWriter.writeJsonField("identifier", this.identifier); + jsonWriter.writeJsonField("version", this.version); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketplaceGalleryImageProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceGalleryImageProperties 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 MarketplaceGalleryImageProperties. + */ + public static MarketplaceGalleryImageProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceGalleryImageProperties deserializedMarketplaceGalleryImageProperties + = new MarketplaceGalleryImageProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("osType".equals(fieldName)) { + deserializedMarketplaceGalleryImageProperties.osType + = OperatingSystemTypes.fromString(reader.getString()); + } else if ("containerId".equals(fieldName)) { + deserializedMarketplaceGalleryImageProperties.containerId = reader.getString(); + } else if ("cloudInitDataSource".equals(fieldName)) { + deserializedMarketplaceGalleryImageProperties.cloudInitDataSource + = CloudInitDataSource.fromString(reader.getString()); + } else if ("hyperVGeneration".equals(fieldName)) { + deserializedMarketplaceGalleryImageProperties.hyperVGeneration + = HyperVGeneration.fromString(reader.getString()); + } else if ("identifier".equals(fieldName)) { + deserializedMarketplaceGalleryImageProperties.identifier = GalleryImageIdentifier.fromJson(reader); + } else if ("version".equals(fieldName)) { + deserializedMarketplaceGalleryImageProperties.version = GalleryImageVersion.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedMarketplaceGalleryImageProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedMarketplaceGalleryImageProperties.status + = MarketplaceGalleryImageStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceGalleryImageProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageStatus.java new file mode 100644 index 000000000000..765ebd52589b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageStatus.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The observed state of marketplace gallery images. + */ +@Immutable +public final class MarketplaceGalleryImageStatus implements JsonSerializable { + /* + * MarketplaceGalleryImage provisioning error code + */ + private String errorCode; + + /* + * Descriptive error message + */ + private String errorMessage; + + /* + * Provisioning status of marketplace gallery image + */ + private MarketplaceGalleryImageStatusProvisioningStatus provisioningStatus; + + /* + * The download status of the gallery image + */ + private MarketplaceGalleryImageStatusDownloadStatus downloadStatus; + + /* + * The progress of the operation in percentage + */ + private Long progressPercentage; + + /** + * Creates an instance of MarketplaceGalleryImageStatus class. + */ + private MarketplaceGalleryImageStatus() { + } + + /** + * Get the errorCode property: MarketplaceGalleryImage provisioning error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: Descriptive error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the provisioningStatus property: Provisioning status of marketplace gallery image. + * + * @return the provisioningStatus value. + */ + public MarketplaceGalleryImageStatusProvisioningStatus provisioningStatus() { + return this.provisioningStatus; + } + + /** + * Get the downloadStatus property: The download status of the gallery image. + * + * @return the downloadStatus value. + */ + public MarketplaceGalleryImageStatusDownloadStatus downloadStatus() { + return this.downloadStatus; + } + + /** + * Get the progressPercentage property: The progress of the operation in percentage. + * + * @return the progressPercentage value. + */ + public Long progressPercentage() { + return this.progressPercentage; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provisioningStatus() != null) { + provisioningStatus().validate(); + } + if (downloadStatus() != null) { + downloadStatus().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeJsonField("provisioningStatus", this.provisioningStatus); + jsonWriter.writeJsonField("downloadStatus", this.downloadStatus); + jsonWriter.writeNumberField("progressPercentage", this.progressPercentage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketplaceGalleryImageStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceGalleryImageStatus 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 MarketplaceGalleryImageStatus. + */ + public static MarketplaceGalleryImageStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceGalleryImageStatus deserializedMarketplaceGalleryImageStatus + = new MarketplaceGalleryImageStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedMarketplaceGalleryImageStatus.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedMarketplaceGalleryImageStatus.errorMessage = reader.getString(); + } else if ("provisioningStatus".equals(fieldName)) { + deserializedMarketplaceGalleryImageStatus.provisioningStatus + = MarketplaceGalleryImageStatusProvisioningStatus.fromJson(reader); + } else if ("downloadStatus".equals(fieldName)) { + deserializedMarketplaceGalleryImageStatus.downloadStatus + = MarketplaceGalleryImageStatusDownloadStatus.fromJson(reader); + } else if ("progressPercentage".equals(fieldName)) { + deserializedMarketplaceGalleryImageStatus.progressPercentage + = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceGalleryImageStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageStatusDownloadStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageStatusDownloadStatus.java new file mode 100644 index 000000000000..49b0792bb07b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageStatusDownloadStatus.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The download status of the gallery image. + */ +@Immutable +public final class MarketplaceGalleryImageStatusDownloadStatus + implements JsonSerializable { + /* + * The downloaded sized of the image in MB + */ + private Long downloadSizeInMB; + + /** + * Creates an instance of MarketplaceGalleryImageStatusDownloadStatus class. + */ + private MarketplaceGalleryImageStatusDownloadStatus() { + } + + /** + * Get the downloadSizeInMB property: The downloaded sized of the image in MB. + * + * @return the downloadSizeInMB value. + */ + public Long downloadSizeInMB() { + return this.downloadSizeInMB; + } + + /** + * 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("downloadSizeInMB", this.downloadSizeInMB); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketplaceGalleryImageStatusDownloadStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceGalleryImageStatusDownloadStatus 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 MarketplaceGalleryImageStatusDownloadStatus. + */ + public static MarketplaceGalleryImageStatusDownloadStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceGalleryImageStatusDownloadStatus deserializedMarketplaceGalleryImageStatusDownloadStatus + = new MarketplaceGalleryImageStatusDownloadStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("downloadSizeInMB".equals(fieldName)) { + deserializedMarketplaceGalleryImageStatusDownloadStatus.downloadSizeInMB + = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceGalleryImageStatusDownloadStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageStatusProvisioningStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageStatusProvisioningStatus.java new file mode 100644 index 000000000000..d4c90eff8072 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageStatusProvisioningStatus.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Marketplace GalleryImage provisioning status. + */ +@Immutable +public final class MarketplaceGalleryImageStatusProvisioningStatus + implements JsonSerializable { + /* + * The ID of the operation performed on the gallery image + */ + private String operationId; + + /* + * The status of the operation performed on the gallery image [Succeeded, Failed, InProgress] + */ + private Status status; + + /** + * Creates an instance of MarketplaceGalleryImageStatusProvisioningStatus class. + */ + private MarketplaceGalleryImageStatusProvisioningStatus() { + } + + /** + * Get the operationId property: The ID of the operation performed on the gallery image. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the status property: The status of the operation performed on the gallery image [Succeeded, Failed, + * InProgress]. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * 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("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketplaceGalleryImageStatusProvisioningStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceGalleryImageStatusProvisioningStatus 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 MarketplaceGalleryImageStatusProvisioningStatus. + */ + public static MarketplaceGalleryImageStatusProvisioningStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceGalleryImageStatusProvisioningStatus deserializedMarketplaceGalleryImageStatusProvisioningStatus + = new MarketplaceGalleryImageStatusProvisioningStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + deserializedMarketplaceGalleryImageStatusProvisioningStatus.operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedMarketplaceGalleryImageStatusProvisioningStatus.status + = Status.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceGalleryImageStatusProvisioningStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageTagsUpdate.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageTagsUpdate.java new file mode 100644 index 000000000000..2322dadac944 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImageTagsUpdate.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The type used for updating tags in MarketplaceGalleryImage resources. + */ +@Fluent +public final class MarketplaceGalleryImageTagsUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of MarketplaceGalleryImageTagsUpdate class. + */ + public MarketplaceGalleryImageTagsUpdate() { + } + + /** + * 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 MarketplaceGalleryImageTagsUpdate object itself. + */ + public MarketplaceGalleryImageTagsUpdate withTags(Map tags) { + this.tags = tags; + 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.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketplaceGalleryImageTagsUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceGalleryImageTagsUpdate 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 MarketplaceGalleryImageTagsUpdate. + */ + public static MarketplaceGalleryImageTagsUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceGalleryImageTagsUpdate deserializedMarketplaceGalleryImageTagsUpdate + = new MarketplaceGalleryImageTagsUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMarketplaceGalleryImageTagsUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceGalleryImageTagsUpdate; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImages.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImages.java new file mode 100644 index 000000000000..f97356f5b9d7 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/MarketplaceGalleryImages.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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 MarketplaceGalleryImages. + */ +public interface MarketplaceGalleryImages { + /** + * Gets a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 marketplace gallery image along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String marketplaceGalleryImageName, Context context); + + /** + * Gets a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 marketplace gallery image. + */ + MarketplaceGalleryImage getByResourceGroup(String resourceGroupName, String marketplaceGalleryImageName); + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 marketplaceGalleryImageName); + + /** + * The operation to delete a marketplace gallery image. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param marketplaceGalleryImageName Name of the marketplace gallery image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 marketplaceGalleryImageName, Context context); + + /** + * Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @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 MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the marketplace gallery images in the specified resource group. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @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 MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the marketplace gallery images in the specified subscription. Use the nextLink property in the + * response to get the next page of marketplace gallery images. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MarketplaceGalleryImage list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a marketplace gallery image. + * + * @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 marketplace gallery image along with {@link Response}. + */ + MarketplaceGalleryImage getById(String id); + + /** + * Gets a marketplace gallery image. + * + * @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 marketplace gallery image along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The operation to delete a marketplace gallery image. + * + * @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); + + /** + * The operation to delete a marketplace gallery image. + * + * @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 MarketplaceGalleryImage resource. + * + * @param name resource name. + * @return the first stage of the new MarketplaceGalleryImage definition. + */ + MarketplaceGalleryImage.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterface.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterface.java new file mode 100644 index 000000000000..3d16319cbce2 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterface.java @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkInterfaceInner; +import java.util.Map; + +/** + * An immutable client-side representation of NetworkInterface. + */ +public interface NetworkInterface { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + NetworkInterfaceProperties properties(); + + /** + * Gets the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkInterfaceInner object. + * + * @return the inner object. + */ + NetworkInterfaceInner innerModel(); + + /** + * The entirety of the NetworkInterface definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The NetworkInterface definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the NetworkInterface definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the NetworkInterface 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 NetworkInterface 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 NetworkInterface definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithExtendedLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + NetworkInterface create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NetworkInterface create(Context context); + } + + /** + * The stage of the NetworkInterface 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 NetworkInterface definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(NetworkInterfaceProperties properties); + } + + /** + * The stage of the NetworkInterface definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extendedLocation of the resource.. + * + * @param extendedLocation The extendedLocation of the resource. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + } + + /** + * Begins update for the NetworkInterface resource. + * + * @return the stage of resource update. + */ + NetworkInterface.Update update(); + + /** + * The template for NetworkInterface update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NetworkInterface apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NetworkInterface apply(Context context); + } + + /** + * The NetworkInterface update stages. + */ + interface UpdateStages { + /** + * The stage of the NetworkInterface 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 NetworkInterface update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Defines the resource properties for the update.. + * + * @param properties Defines the resource properties for the update. + * @return the next definition stage. + */ + Update withProperties(NetworkInterfacesUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NetworkInterface refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NetworkInterface refresh(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceArmReference.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceArmReference.java new file mode 100644 index 000000000000..421694b7f8fb --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceArmReference.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The ARM ID for a Network Interface. + */ +@Fluent +public final class NetworkInterfaceArmReference implements JsonSerializable { + /* + * The ARM ID for a Network Interface. + */ + private String id; + + /** + * Creates an instance of NetworkInterfaceArmReference class. + */ + public NetworkInterfaceArmReference() { + } + + /** + * Get the id property: The ARM ID for a Network Interface. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM ID for a Network Interface. + * + * @param id the id value to set. + * @return the NetworkInterfaceArmReference object itself. + */ + public NetworkInterfaceArmReference withId(String id) { + this.id = id; + 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("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkInterfaceArmReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkInterfaceArmReference 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 NetworkInterfaceArmReference. + */ + public static NetworkInterfaceArmReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkInterfaceArmReference deserializedNetworkInterfaceArmReference = new NetworkInterfaceArmReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNetworkInterfaceArmReference.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkInterfaceArmReference; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceProperties.java new file mode 100644 index 000000000000..809894ca95f5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceProperties.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Properties under the network interface resource. + */ +@Fluent +public final class NetworkInterfaceProperties implements JsonSerializable { + /* + * IPConfigurations - A list of IPConfigurations of the network interface. + */ + private List ipConfigurations; + + /* + * MacAddress - The MAC address of the network interface. + */ + private String macAddress; + + /* + * DNS Settings for the interface + */ + private InterfaceDNSSettings dnsSettings; + + /* + * Boolean indicating whether this is a existing local network interface or if one should be created. + */ + private Boolean createFromLocal; + + /* + * Provisioning state of the network interface. + */ + private ProvisioningStateEnum provisioningState; + + /* + * The observed state of network interfaces + */ + private NetworkInterfaceStatus status; + + /* + * NetworkSecurityGroup - Network Security Group attached to the network interface. + */ + private NetworkSecurityGroupArmReference networkSecurityGroup; + + /** + * Creates an instance of NetworkInterfaceProperties class. + */ + public NetworkInterfaceProperties() { + } + + /** + * Get the ipConfigurations property: IPConfigurations - A list of IPConfigurations of the network interface. + * + * @return the ipConfigurations value. + */ + public List ipConfigurations() { + return this.ipConfigurations; + } + + /** + * Set the ipConfigurations property: IPConfigurations - A list of IPConfigurations of the network interface. + * + * @param ipConfigurations the ipConfigurations value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withIpConfigurations(List ipConfigurations) { + this.ipConfigurations = ipConfigurations; + return this; + } + + /** + * Get the macAddress property: MacAddress - The MAC address of the network interface. + * + * @return the macAddress value. + */ + public String macAddress() { + return this.macAddress; + } + + /** + * Set the macAddress property: MacAddress - The MAC address of the network interface. + * + * @param macAddress the macAddress value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withMacAddress(String macAddress) { + this.macAddress = macAddress; + return this; + } + + /** + * Get the dnsSettings property: DNS Settings for the interface. + * + * @return the dnsSettings value. + */ + public InterfaceDNSSettings dnsSettings() { + return this.dnsSettings; + } + + /** + * Set the dnsSettings property: DNS Settings for the interface. + * + * @param dnsSettings the dnsSettings value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withDnsSettings(InterfaceDNSSettings dnsSettings) { + this.dnsSettings = dnsSettings; + return this; + } + + /** + * Get the createFromLocal property: Boolean indicating whether this is a existing local network interface or if one + * should be created. + * + * @return the createFromLocal value. + */ + public Boolean createFromLocal() { + return this.createFromLocal; + } + + /** + * Set the createFromLocal property: Boolean indicating whether this is a existing local network interface or if one + * should be created. + * + * @param createFromLocal the createFromLocal value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withCreateFromLocal(Boolean createFromLocal) { + this.createFromLocal = createFromLocal; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the network interface. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Get the status property: The observed state of network interfaces. + * + * @return the status value. + */ + public NetworkInterfaceStatus status() { + return this.status; + } + + /** + * Get the networkSecurityGroup property: NetworkSecurityGroup - Network Security Group attached to the network + * interface. + * + * @return the networkSecurityGroup value. + */ + public NetworkSecurityGroupArmReference networkSecurityGroup() { + return this.networkSecurityGroup; + } + + /** + * Set the networkSecurityGroup property: NetworkSecurityGroup - Network Security Group attached to the network + * interface. + * + * @param networkSecurityGroup the networkSecurityGroup value to set. + * @return the NetworkInterfaceProperties object itself. + */ + public NetworkInterfaceProperties withNetworkSecurityGroup(NetworkSecurityGroupArmReference networkSecurityGroup) { + this.networkSecurityGroup = networkSecurityGroup; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ipConfigurations() != null) { + ipConfigurations().forEach(e -> e.validate()); + } + if (dnsSettings() != null) { + dnsSettings().validate(); + } + if (status() != null) { + status().validate(); + } + if (networkSecurityGroup() != null) { + networkSecurityGroup().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("ipConfigurations", this.ipConfigurations, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("macAddress", this.macAddress); + jsonWriter.writeJsonField("dnsSettings", this.dnsSettings); + jsonWriter.writeBooleanField("createFromLocal", this.createFromLocal); + jsonWriter.writeJsonField("networkSecurityGroup", this.networkSecurityGroup); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkInterfaceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkInterfaceProperties 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 NetworkInterfaceProperties. + */ + public static NetworkInterfaceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkInterfaceProperties deserializedNetworkInterfaceProperties = new NetworkInterfaceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ipConfigurations".equals(fieldName)) { + List ipConfigurations + = reader.readArray(reader1 -> IPConfiguration.fromJson(reader1)); + deserializedNetworkInterfaceProperties.ipConfigurations = ipConfigurations; + } else if ("macAddress".equals(fieldName)) { + deserializedNetworkInterfaceProperties.macAddress = reader.getString(); + } else if ("dnsSettings".equals(fieldName)) { + deserializedNetworkInterfaceProperties.dnsSettings = InterfaceDNSSettings.fromJson(reader); + } else if ("createFromLocal".equals(fieldName)) { + deserializedNetworkInterfaceProperties.createFromLocal = reader.getNullable(JsonReader::getBoolean); + } else if ("provisioningState".equals(fieldName)) { + deserializedNetworkInterfaceProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedNetworkInterfaceProperties.status = NetworkInterfaceStatus.fromJson(reader); + } else if ("networkSecurityGroup".equals(fieldName)) { + deserializedNetworkInterfaceProperties.networkSecurityGroup + = NetworkSecurityGroupArmReference.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkInterfaceProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceStatus.java new file mode 100644 index 000000000000..00505df328dd --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceStatus.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The observed state of network interfaces. + */ +@Immutable +public final class NetworkInterfaceStatus implements JsonSerializable { + /* + * NetworkInterface provisioning error code + */ + private String errorCode; + + /* + * Descriptive error message + */ + private String errorMessage; + + /* + * Network interface provisioning status + */ + private NetworkInterfaceStatusProvisioningStatus provisioningStatus; + + /** + * Creates an instance of NetworkInterfaceStatus class. + */ + private NetworkInterfaceStatus() { + } + + /** + * Get the errorCode property: NetworkInterface provisioning error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: Descriptive error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the provisioningStatus property: Network interface provisioning status. + * + * @return the provisioningStatus value. + */ + public NetworkInterfaceStatusProvisioningStatus provisioningStatus() { + return this.provisioningStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provisioningStatus() != null) { + provisioningStatus().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeJsonField("provisioningStatus", this.provisioningStatus); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkInterfaceStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkInterfaceStatus 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 NetworkInterfaceStatus. + */ + public static NetworkInterfaceStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkInterfaceStatus deserializedNetworkInterfaceStatus = new NetworkInterfaceStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedNetworkInterfaceStatus.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedNetworkInterfaceStatus.errorMessage = reader.getString(); + } else if ("provisioningStatus".equals(fieldName)) { + deserializedNetworkInterfaceStatus.provisioningStatus + = NetworkInterfaceStatusProvisioningStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkInterfaceStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceStatusProvisioningStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceStatusProvisioningStatus.java new file mode 100644 index 000000000000..c2d0f4033dad --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaceStatusProvisioningStatus.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Network interface provisioning status. + */ +@Immutable +public final class NetworkInterfaceStatusProvisioningStatus + implements JsonSerializable { + /* + * The ID of the operation performed on the network interface + */ + private String operationId; + + /* + * The status of the operation performed on the network interface [Succeeded, Failed, InProgress] + */ + private Status status; + + /** + * Creates an instance of NetworkInterfaceStatusProvisioningStatus class. + */ + private NetworkInterfaceStatusProvisioningStatus() { + } + + /** + * Get the operationId property: The ID of the operation performed on the network interface. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the status property: The status of the operation performed on the network interface [Succeeded, Failed, + * InProgress]. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * 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("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkInterfaceStatusProvisioningStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkInterfaceStatusProvisioningStatus 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 NetworkInterfaceStatusProvisioningStatus. + */ + public static NetworkInterfaceStatusProvisioningStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkInterfaceStatusProvisioningStatus deserializedNetworkInterfaceStatusProvisioningStatus + = new NetworkInterfaceStatusProvisioningStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + deserializedNetworkInterfaceStatusProvisioningStatus.operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedNetworkInterfaceStatusProvisioningStatus.status = Status.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkInterfaceStatusProvisioningStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaces.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaces.java new file mode 100644 index 000000000000..0fbe3703318a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfaces.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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 NetworkInterfaces. + */ +public interface NetworkInterfaces { + /** + * Gets a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 network interface along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String networkInterfaceName, + Context context); + + /** + * Gets a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 network interface. + */ + NetworkInterface getByResourceGroup(String resourceGroupName, String networkInterfaceName); + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkInterfaceName); + + /** + * The operation to delete a network interface. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkInterfaceName Name of the network interface. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkInterfaceName, Context context); + + /** + * Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @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 NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the network interfaces in the specified resource group. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @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 NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the network interfaces in the specified subscription. Use the nextLink property in the response to + * get the next page of network interfaces. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NetworkInterface list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a network interface. + * + * @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 network interface along with {@link Response}. + */ + NetworkInterface getById(String id); + + /** + * Gets a network interface. + * + * @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 network interface along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The operation to delete a network interface. + * + * @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); + + /** + * The operation to delete a network interface. + * + * @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 NetworkInterface resource. + * + * @param name resource name. + * @return the first stage of the new NetworkInterface definition. + */ + NetworkInterface.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfacesUpdateProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfacesUpdateProperties.java new file mode 100644 index 000000000000..ddda9492c649 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfacesUpdateProperties.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Defines the resource properties for the update. + */ +@Fluent +public final class NetworkInterfacesUpdateProperties implements JsonSerializable { + /* + * NetworkSecurityGroup - Network Security Group attached to the network interface. + */ + private NetworkSecurityGroupArmReference networkSecurityGroup; + + /* + * DNS Settings for the interface + */ + private InterfaceDNSSettings dnsSettings; + + /** + * Creates an instance of NetworkInterfacesUpdateProperties class. + */ + public NetworkInterfacesUpdateProperties() { + } + + /** + * Get the networkSecurityGroup property: NetworkSecurityGroup - Network Security Group attached to the network + * interface. + * + * @return the networkSecurityGroup value. + */ + public NetworkSecurityGroupArmReference networkSecurityGroup() { + return this.networkSecurityGroup; + } + + /** + * Set the networkSecurityGroup property: NetworkSecurityGroup - Network Security Group attached to the network + * interface. + * + * @param networkSecurityGroup the networkSecurityGroup value to set. + * @return the NetworkInterfacesUpdateProperties object itself. + */ + public NetworkInterfacesUpdateProperties + withNetworkSecurityGroup(NetworkSecurityGroupArmReference networkSecurityGroup) { + this.networkSecurityGroup = networkSecurityGroup; + return this; + } + + /** + * Get the dnsSettings property: DNS Settings for the interface. + * + * @return the dnsSettings value. + */ + public InterfaceDNSSettings dnsSettings() { + return this.dnsSettings; + } + + /** + * Set the dnsSettings property: DNS Settings for the interface. + * + * @param dnsSettings the dnsSettings value to set. + * @return the NetworkInterfacesUpdateProperties object itself. + */ + public NetworkInterfacesUpdateProperties withDnsSettings(InterfaceDNSSettings dnsSettings) { + this.dnsSettings = dnsSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkSecurityGroup() != null) { + networkSecurityGroup().validate(); + } + if (dnsSettings() != null) { + dnsSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("networkSecurityGroup", this.networkSecurityGroup); + jsonWriter.writeJsonField("dnsSettings", this.dnsSettings); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkInterfacesUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkInterfacesUpdateProperties 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 NetworkInterfacesUpdateProperties. + */ + public static NetworkInterfacesUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkInterfacesUpdateProperties deserializedNetworkInterfacesUpdateProperties + = new NetworkInterfacesUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("networkSecurityGroup".equals(fieldName)) { + deserializedNetworkInterfacesUpdateProperties.networkSecurityGroup + = NetworkSecurityGroupArmReference.fromJson(reader); + } else if ("dnsSettings".equals(fieldName)) { + deserializedNetworkInterfacesUpdateProperties.dnsSettings = InterfaceDNSSettings.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkInterfacesUpdateProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfacesUpdateRequest.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfacesUpdateRequest.java new file mode 100644 index 000000000000..079ed2221af3 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkInterfacesUpdateRequest.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The network interface resource patch definition. + */ +@Fluent +public final class NetworkInterfacesUpdateRequest implements JsonSerializable { + /* + * Resource tags + */ + private Map tags; + + /* + * Defines the resource properties for the update. + */ + private NetworkInterfacesUpdateProperties properties; + + /** + * Creates an instance of NetworkInterfacesUpdateRequest class. + */ + public NetworkInterfacesUpdateRequest() { + } + + /** + * 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 NetworkInterfacesUpdateRequest object itself. + */ + public NetworkInterfacesUpdateRequest withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: Defines the resource properties for the update. + * + * @return the properties value. + */ + public NetworkInterfacesUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Defines the resource properties for the update. + * + * @param properties the properties value to set. + * @return the NetworkInterfacesUpdateRequest object itself. + */ + public NetworkInterfacesUpdateRequest withProperties(NetworkInterfacesUpdateProperties 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.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkInterfacesUpdateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkInterfacesUpdateRequest 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 NetworkInterfacesUpdateRequest. + */ + public static NetworkInterfacesUpdateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkInterfacesUpdateRequest deserializedNetworkInterfacesUpdateRequest + = new NetworkInterfacesUpdateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedNetworkInterfacesUpdateRequest.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedNetworkInterfacesUpdateRequest.properties + = NetworkInterfacesUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkInterfacesUpdateRequest; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkProfileUpdate.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkProfileUpdate.java new file mode 100644 index 000000000000..e985eafd80b9 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkProfileUpdate.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * NetworkProfile - describes the network update configuration the virtual machine instance. + */ +@Fluent +public final class NetworkProfileUpdate implements JsonSerializable { + /* + * NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + */ + private List networkInterfaces; + + /** + * Creates an instance of NetworkProfileUpdate class. + */ + public NetworkProfileUpdate() { + } + + /** + * Get the networkInterfaces property: NetworkInterfaces - list of network interfaces to be attached to the virtual + * machine instance. + * + * @return the networkInterfaces value. + */ + public List networkInterfaces() { + return this.networkInterfaces; + } + + /** + * Set the networkInterfaces property: NetworkInterfaces - list of network interfaces to be attached to the virtual + * machine instance. + * + * @param networkInterfaces the networkInterfaces value to set. + * @return the NetworkProfileUpdate object itself. + */ + public NetworkProfileUpdate withNetworkInterfaces(List networkInterfaces) { + this.networkInterfaces = networkInterfaces; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkInterfaces() != null) { + networkInterfaces().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("networkInterfaces", this.networkInterfaces, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkProfileUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkProfileUpdate 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 NetworkProfileUpdate. + */ + public static NetworkProfileUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkProfileUpdate deserializedNetworkProfileUpdate = new NetworkProfileUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("networkInterfaces".equals(fieldName)) { + List networkInterfaces + = reader.readArray(reader1 -> NetworkInterfaceArmReference.fromJson(reader1)); + deserializedNetworkProfileUpdate.networkInterfaces = networkInterfaces; + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkProfileUpdate; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroup.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroup.java new file mode 100644 index 000000000000..f1b0a701d29d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroup.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkSecurityGroupInner; +import java.util.Map; + +/** + * An immutable client-side representation of NetworkSecurityGroup. + */ +public interface NetworkSecurityGroup { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + NetworkSecurityGroupProperties properties(); + + /** + * Gets the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the eTag property: If eTag is provided in the response body, it may also be provided as a header per the + * normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. + * HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), + * and If-Range (section 14.27) header fields. + * + * @return the eTag value. + */ + String eTag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkSecurityGroupInner object. + * + * @return the inner object. + */ + NetworkSecurityGroupInner innerModel(); + + /** + * The entirety of the NetworkSecurityGroup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The NetworkSecurityGroup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the NetworkSecurityGroup definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the NetworkSecurityGroup 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 NetworkSecurityGroup 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 NetworkSecurityGroup definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithExtendedLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + NetworkSecurityGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NetworkSecurityGroup create(Context context); + } + + /** + * The stage of the NetworkSecurityGroup 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 NetworkSecurityGroup definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(NetworkSecurityGroupProperties properties); + } + + /** + * The stage of the NetworkSecurityGroup definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extendedLocation of the resource.. + * + * @param extendedLocation The extendedLocation of the resource. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + } + + /** + * Begins update for the NetworkSecurityGroup resource. + * + * @return the stage of resource update. + */ + NetworkSecurityGroup.Update update(); + + /** + * The template for NetworkSecurityGroup update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NetworkSecurityGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NetworkSecurityGroup apply(Context context); + } + + /** + * The NetworkSecurityGroup update stages. + */ + interface UpdateStages { + /** + * The stage of the NetworkSecurityGroup 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); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NetworkSecurityGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NetworkSecurityGroup refresh(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupArmReference.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupArmReference.java new file mode 100644 index 000000000000..bfc80da675be --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupArmReference.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The ARM ID for a Network Security Group. + */ +@Fluent +public final class NetworkSecurityGroupArmReference implements JsonSerializable { + /* + * The ARM ID for a Network Security Group. + */ + private String id; + + /** + * Creates an instance of NetworkSecurityGroupArmReference class. + */ + public NetworkSecurityGroupArmReference() { + } + + /** + * Get the id property: The ARM ID for a Network Security Group. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM ID for a Network Security Group. + * + * @param id the id value to set. + * @return the NetworkSecurityGroupArmReference object itself. + */ + public NetworkSecurityGroupArmReference withId(String id) { + this.id = id; + 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("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkSecurityGroupArmReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkSecurityGroupArmReference 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 NetworkSecurityGroupArmReference. + */ + public static NetworkSecurityGroupArmReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkSecurityGroupArmReference deserializedNetworkSecurityGroupArmReference + = new NetworkSecurityGroupArmReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNetworkSecurityGroupArmReference.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkSecurityGroupArmReference; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupProperties.java new file mode 100644 index 000000000000..8573c91d68a1 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupProperties.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Network Security Group resource. + */ +@Immutable +public final class NetworkSecurityGroupProperties implements JsonSerializable { + /* + * A collection of references to network interfaces that are currently using this NSG. + */ + private List networkInterfaces; + + /* + * A collection of references to logical networks that are currently using this NSG + */ + private List subnets; + + /* + * The provisioning state of the network security group resource. + */ + private ProvisioningStateEnum provisioningState; + + /* + * The observed state of Network Security Group + */ + private NetworkSecurityGroupStatus status; + + /** + * Creates an instance of NetworkSecurityGroupProperties class. + */ + public NetworkSecurityGroupProperties() { + } + + /** + * Get the networkInterfaces property: A collection of references to network interfaces that are currently using + * this NSG. + * + * @return the networkInterfaces value. + */ + public List networkInterfaces() { + return this.networkInterfaces; + } + + /** + * Get the subnets property: A collection of references to logical networks that are currently using this NSG. + * + * @return the subnets value. + */ + public List subnets() { + return this.subnets; + } + + /** + * Get the provisioningState property: The provisioning state of the network security group resource. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Get the status property: The observed state of Network Security Group. + * + * @return the status value. + */ + public NetworkSecurityGroupStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkInterfaces() != null) { + networkInterfaces().forEach(e -> e.validate()); + } + if (subnets() != null) { + subnets().forEach(e -> e.validate()); + } + if (status() != null) { + status().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkSecurityGroupProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkSecurityGroupProperties 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 NetworkSecurityGroupProperties. + */ + public static NetworkSecurityGroupProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkSecurityGroupProperties deserializedNetworkSecurityGroupProperties + = new NetworkSecurityGroupProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("networkInterfaces".equals(fieldName)) { + List networkInterfaces + = reader.readArray(reader1 -> NetworkInterfaceArmReference.fromJson(reader1)); + deserializedNetworkSecurityGroupProperties.networkInterfaces = networkInterfaces; + } else if ("subnets".equals(fieldName)) { + List subnets + = reader.readArray(reader1 -> LogicalNetworkArmReference.fromJson(reader1)); + deserializedNetworkSecurityGroupProperties.subnets = subnets; + } else if ("provisioningState".equals(fieldName)) { + deserializedNetworkSecurityGroupProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedNetworkSecurityGroupProperties.status = NetworkSecurityGroupStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkSecurityGroupProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupStatus.java new file mode 100644 index 000000000000..5e73f359b6a0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupStatus.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The observed state of network security group. + */ +@Immutable +public final class NetworkSecurityGroupStatus implements JsonSerializable { + /* + * NetworkSecurityGroup provisioning error code + */ + private String errorCode; + + /* + * Descriptive error message + */ + private String errorMessage; + + /* + * network security group provisioning status + */ + private NetworkSecurityGroupStatusProvisioningStatus provisioningStatus; + + /** + * Creates an instance of NetworkSecurityGroupStatus class. + */ + private NetworkSecurityGroupStatus() { + } + + /** + * Get the errorCode property: NetworkSecurityGroup provisioning error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: Descriptive error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the provisioningStatus property: network security group provisioning status. + * + * @return the provisioningStatus value. + */ + public NetworkSecurityGroupStatusProvisioningStatus provisioningStatus() { + return this.provisioningStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provisioningStatus() != null) { + provisioningStatus().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeJsonField("provisioningStatus", this.provisioningStatus); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkSecurityGroupStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkSecurityGroupStatus 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 NetworkSecurityGroupStatus. + */ + public static NetworkSecurityGroupStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkSecurityGroupStatus deserializedNetworkSecurityGroupStatus = new NetworkSecurityGroupStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedNetworkSecurityGroupStatus.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedNetworkSecurityGroupStatus.errorMessage = reader.getString(); + } else if ("provisioningStatus".equals(fieldName)) { + deserializedNetworkSecurityGroupStatus.provisioningStatus + = NetworkSecurityGroupStatusProvisioningStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkSecurityGroupStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupStatusProvisioningStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupStatusProvisioningStatus.java new file mode 100644 index 000000000000..3d7b560f3141 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupStatusProvisioningStatus.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * network security group provisioning status. + */ +@Immutable +public final class NetworkSecurityGroupStatusProvisioningStatus + implements JsonSerializable { + /* + * The ID of the operation performed on the network security group + */ + private String operationId; + + /* + * The status of the operation performed on the network security group [Succeeded, Failed, InProgress] + */ + private Status status; + + /** + * Creates an instance of NetworkSecurityGroupStatusProvisioningStatus class. + */ + private NetworkSecurityGroupStatusProvisioningStatus() { + } + + /** + * Get the operationId property: The ID of the operation performed on the network security group. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the status property: The status of the operation performed on the network security group [Succeeded, Failed, + * InProgress]. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * 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("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkSecurityGroupStatusProvisioningStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkSecurityGroupStatusProvisioningStatus 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 NetworkSecurityGroupStatusProvisioningStatus. + */ + public static NetworkSecurityGroupStatusProvisioningStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkSecurityGroupStatusProvisioningStatus deserializedNetworkSecurityGroupStatusProvisioningStatus + = new NetworkSecurityGroupStatusProvisioningStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + deserializedNetworkSecurityGroupStatusProvisioningStatus.operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedNetworkSecurityGroupStatusProvisioningStatus.status + = Status.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkSecurityGroupStatusProvisioningStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupTagsUpdate.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupTagsUpdate.java new file mode 100644 index 000000000000..76c786d847e4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroupTagsUpdate.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The type used for updating tags in NetworkSecurityGroup resources. + */ +@Fluent +public final class NetworkSecurityGroupTagsUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of NetworkSecurityGroupTagsUpdate class. + */ + public NetworkSecurityGroupTagsUpdate() { + } + + /** + * 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 NetworkSecurityGroupTagsUpdate object itself. + */ + public NetworkSecurityGroupTagsUpdate withTags(Map tags) { + this.tags = tags; + 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.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NetworkSecurityGroupTagsUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NetworkSecurityGroupTagsUpdate 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 NetworkSecurityGroupTagsUpdate. + */ + public static NetworkSecurityGroupTagsUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NetworkSecurityGroupTagsUpdate deserializedNetworkSecurityGroupTagsUpdate + = new NetworkSecurityGroupTagsUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedNetworkSecurityGroupTagsUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedNetworkSecurityGroupTagsUpdate; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroups.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroups.java new file mode 100644 index 000000000000..055dcc9941c0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/NetworkSecurityGroups.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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 NetworkSecurityGroups. + */ +public interface NetworkSecurityGroups { + /** + * Gets the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified network security group along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String networkSecurityGroupName, Context context); + + /** + * Gets the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified network security group. + */ + NetworkSecurityGroup getByResourceGroup(String resourceGroupName, String networkSecurityGroupName); + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkSecurityGroupName); + + /** + * Deletes the specified network security group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkSecurityGroupName, Context context); + + /** + * Gets all network security groups in a 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 all network security groups in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all network security groups in a 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 all network security groups in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets all network security groups in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets all network security groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all network security groups in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the specified network security group. + * + * @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 the specified network security group along with {@link Response}. + */ + NetworkSecurityGroup getById(String id); + + /** + * Gets the specified network security group. + * + * @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 the specified network security group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified network security group. + * + * @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); + + /** + * Deletes the specified network security group. + * + * @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 NetworkSecurityGroup resource. + * + * @param name resource name. + * @return the first stage of the new NetworkSecurityGroup definition. + */ + NetworkSecurityGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OperatingSystemTypes.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OperatingSystemTypes.java new file mode 100644 index 000000000000..1529e9b7a053 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OperatingSystemTypes.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Operating system type that the gallery image uses [Windows, Linux]. + */ +public final class OperatingSystemTypes extends ExpandableStringEnum { + /** + * Windows operating system. + */ + public static final OperatingSystemTypes WINDOWS = fromString("Windows"); + + /** + * Linux operating system. + */ + public static final OperatingSystemTypes LINUX = fromString("Linux"); + + /** + * Creates a new instance of OperatingSystemTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OperatingSystemTypes() { + } + + /** + * Creates or finds a OperatingSystemTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperatingSystemTypes. + */ + public static OperatingSystemTypes fromString(String name) { + return fromString(name, OperatingSystemTypes.class); + } + + /** + * Gets known OperatingSystemTypes values. + * + * @return known OperatingSystemTypes values. + */ + public static Collection values() { + return values(OperatingSystemTypes.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OsProfileUpdate.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OsProfileUpdate.java new file mode 100644 index 000000000000..198999d0d1f5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OsProfileUpdate.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * OsProfile - describes the update configuration of the operating system. + */ +@Fluent +public final class OsProfileUpdate implements JsonSerializable { + /* + * ComputerName - name of the computer + */ + private String computerName; + + /* + * Linux configuration properties + */ + private OsProfileUpdateLinuxConfiguration linuxConfiguration; + + /* + * Windows configuration properties + */ + private OsProfileUpdateWindowsConfiguration windowsConfiguration; + + /** + * Creates an instance of OsProfileUpdate class. + */ + public OsProfileUpdate() { + } + + /** + * Get the computerName property: ComputerName - name of the computer. + * + * @return the computerName value. + */ + public String computerName() { + return this.computerName; + } + + /** + * Set the computerName property: ComputerName - name of the computer. + * + * @param computerName the computerName value to set. + * @return the OsProfileUpdate object itself. + */ + public OsProfileUpdate withComputerName(String computerName) { + this.computerName = computerName; + return this; + } + + /** + * Get the linuxConfiguration property: Linux configuration properties. + * + * @return the linuxConfiguration value. + */ + public OsProfileUpdateLinuxConfiguration linuxConfiguration() { + return this.linuxConfiguration; + } + + /** + * Set the linuxConfiguration property: Linux configuration properties. + * + * @param linuxConfiguration the linuxConfiguration value to set. + * @return the OsProfileUpdate object itself. + */ + public OsProfileUpdate withLinuxConfiguration(OsProfileUpdateLinuxConfiguration linuxConfiguration) { + this.linuxConfiguration = linuxConfiguration; + return this; + } + + /** + * Get the windowsConfiguration property: Windows configuration properties. + * + * @return the windowsConfiguration value. + */ + public OsProfileUpdateWindowsConfiguration windowsConfiguration() { + return this.windowsConfiguration; + } + + /** + * Set the windowsConfiguration property: Windows configuration properties. + * + * @param windowsConfiguration the windowsConfiguration value to set. + * @return the OsProfileUpdate object itself. + */ + public OsProfileUpdate withWindowsConfiguration(OsProfileUpdateWindowsConfiguration windowsConfiguration) { + this.windowsConfiguration = windowsConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (linuxConfiguration() != null) { + linuxConfiguration().validate(); + } + if (windowsConfiguration() != null) { + windowsConfiguration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("computerName", this.computerName); + jsonWriter.writeJsonField("linuxConfiguration", this.linuxConfiguration); + jsonWriter.writeJsonField("windowsConfiguration", this.windowsConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OsProfileUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OsProfileUpdate 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 OsProfileUpdate. + */ + public static OsProfileUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OsProfileUpdate deserializedOsProfileUpdate = new OsProfileUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("computerName".equals(fieldName)) { + deserializedOsProfileUpdate.computerName = reader.getString(); + } else if ("linuxConfiguration".equals(fieldName)) { + deserializedOsProfileUpdate.linuxConfiguration = OsProfileUpdateLinuxConfiguration.fromJson(reader); + } else if ("windowsConfiguration".equals(fieldName)) { + deserializedOsProfileUpdate.windowsConfiguration + = OsProfileUpdateWindowsConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOsProfileUpdate; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OsProfileUpdateLinuxConfiguration.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OsProfileUpdateLinuxConfiguration.java new file mode 100644 index 000000000000..3d50e1fa5dc4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OsProfileUpdateLinuxConfiguration.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * OSProfile update linux configuration. + */ +@Fluent +public final class OsProfileUpdateLinuxConfiguration implements JsonSerializable { + /* + * Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance + * creation process. + */ + private Boolean provisionVMAgent; + + /* + * Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + */ + private Boolean provisionVMConfigAgent; + + /** + * Creates an instance of OsProfileUpdateLinuxConfiguration class. + */ + public OsProfileUpdateLinuxConfiguration() { + } + + /** + * Get the provisionVMAgent property: Used to indicate whether Arc for Servers agent onboarding should be triggered + * during the virtual machine instance creation process. + * + * @return the provisionVMAgent value. + */ + public Boolean provisionVMAgent() { + return this.provisionVMAgent; + } + + /** + * Set the provisionVMAgent property: Used to indicate whether Arc for Servers agent onboarding should be triggered + * during the virtual machine instance creation process. + * + * @param provisionVMAgent the provisionVMAgent value to set. + * @return the OsProfileUpdateLinuxConfiguration object itself. + */ + public OsProfileUpdateLinuxConfiguration withProvisionVMAgent(Boolean provisionVMAgent) { + this.provisionVMAgent = provisionVMAgent; + return this; + } + + /** + * Get the provisionVMConfigAgent property: Used to indicate whether the VM Config Agent should be installed during + * the virtual machine creation process. + * + * @return the provisionVMConfigAgent value. + */ + public Boolean provisionVMConfigAgent() { + return this.provisionVMConfigAgent; + } + + /** + * Set the provisionVMConfigAgent property: Used to indicate whether the VM Config Agent should be installed during + * the virtual machine creation process. + * + * @param provisionVMConfigAgent the provisionVMConfigAgent value to set. + * @return the OsProfileUpdateLinuxConfiguration object itself. + */ + public OsProfileUpdateLinuxConfiguration withProvisionVMConfigAgent(Boolean provisionVMConfigAgent) { + this.provisionVMConfigAgent = provisionVMConfigAgent; + 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("provisionVMAgent", this.provisionVMAgent); + jsonWriter.writeBooleanField("provisionVMConfigAgent", this.provisionVMConfigAgent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OsProfileUpdateLinuxConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OsProfileUpdateLinuxConfiguration 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 OsProfileUpdateLinuxConfiguration. + */ + public static OsProfileUpdateLinuxConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OsProfileUpdateLinuxConfiguration deserializedOsProfileUpdateLinuxConfiguration + = new OsProfileUpdateLinuxConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisionVMAgent".equals(fieldName)) { + deserializedOsProfileUpdateLinuxConfiguration.provisionVMAgent + = reader.getNullable(JsonReader::getBoolean); + } else if ("provisionVMConfigAgent".equals(fieldName)) { + deserializedOsProfileUpdateLinuxConfiguration.provisionVMConfigAgent + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedOsProfileUpdateLinuxConfiguration; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OsProfileUpdateWindowsConfiguration.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OsProfileUpdateWindowsConfiguration.java new file mode 100644 index 000000000000..1229804a86e0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/OsProfileUpdateWindowsConfiguration.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * OSProfile update windows configuration. + */ +@Fluent +public final class OsProfileUpdateWindowsConfiguration + implements JsonSerializable { + /* + * Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance + * creation process. + */ + private Boolean provisionVMAgent; + + /* + * Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + */ + private Boolean provisionVMConfigAgent; + + /** + * Creates an instance of OsProfileUpdateWindowsConfiguration class. + */ + public OsProfileUpdateWindowsConfiguration() { + } + + /** + * Get the provisionVMAgent property: Used to indicate whether Arc for Servers agent onboarding should be triggered + * during the virtual machine instance creation process. + * + * @return the provisionVMAgent value. + */ + public Boolean provisionVMAgent() { + return this.provisionVMAgent; + } + + /** + * Set the provisionVMAgent property: Used to indicate whether Arc for Servers agent onboarding should be triggered + * during the virtual machine instance creation process. + * + * @param provisionVMAgent the provisionVMAgent value to set. + * @return the OsProfileUpdateWindowsConfiguration object itself. + */ + public OsProfileUpdateWindowsConfiguration withProvisionVMAgent(Boolean provisionVMAgent) { + this.provisionVMAgent = provisionVMAgent; + return this; + } + + /** + * Get the provisionVMConfigAgent property: Used to indicate whether the VM Config Agent should be installed during + * the virtual machine creation process. + * + * @return the provisionVMConfigAgent value. + */ + public Boolean provisionVMConfigAgent() { + return this.provisionVMConfigAgent; + } + + /** + * Set the provisionVMConfigAgent property: Used to indicate whether the VM Config Agent should be installed during + * the virtual machine creation process. + * + * @param provisionVMConfigAgent the provisionVMConfigAgent value to set. + * @return the OsProfileUpdateWindowsConfiguration object itself. + */ + public OsProfileUpdateWindowsConfiguration withProvisionVMConfigAgent(Boolean provisionVMConfigAgent) { + this.provisionVMConfigAgent = provisionVMConfigAgent; + 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("provisionVMAgent", this.provisionVMAgent); + jsonWriter.writeBooleanField("provisionVMConfigAgent", this.provisionVMConfigAgent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OsProfileUpdateWindowsConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OsProfileUpdateWindowsConfiguration 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 OsProfileUpdateWindowsConfiguration. + */ + public static OsProfileUpdateWindowsConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OsProfileUpdateWindowsConfiguration deserializedOsProfileUpdateWindowsConfiguration + = new OsProfileUpdateWindowsConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisionVMAgent".equals(fieldName)) { + deserializedOsProfileUpdateWindowsConfiguration.provisionVMAgent + = reader.getNullable(JsonReader::getBoolean); + } else if ("provisionVMConfigAgent".equals(fieldName)) { + deserializedOsProfileUpdateWindowsConfiguration.provisionVMConfigAgent + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedOsProfileUpdateWindowsConfiguration; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/PowerStateEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/PowerStateEnum.java new file mode 100644 index 000000000000..ac27f42775bd --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/PowerStateEnum.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The power state of the virtual machine instance. + */ +public final class PowerStateEnum extends ExpandableStringEnum { + /** + * Virtual machine deallocated. + */ + public static final PowerStateEnum DEALLOCATED = fromString("Deallocated"); + + /** + * Virtual machine deallocating. + */ + public static final PowerStateEnum DEALLOCATING = fromString("Deallocating"); + + /** + * Virtual machine running. + */ + public static final PowerStateEnum RUNNING = fromString("Running"); + + /** + * Virtual machine starting. + */ + public static final PowerStateEnum STARTING = fromString("Starting"); + + /** + * Virtual machine stopped. + */ + public static final PowerStateEnum STOPPED = fromString("Stopped"); + + /** + * Virtual machine stopping. + */ + public static final PowerStateEnum STOPPING = fromString("Stopping"); + + /** + * Virtual machine paused. + */ + public static final PowerStateEnum PAUSED = fromString("Paused"); + + /** + * Virtual machine Saved,. + */ + public static final PowerStateEnum SAVED = fromString("Saved"); + + /** + * Power state of the virtual machine is unknown. + */ + public static final PowerStateEnum UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of PowerStateEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PowerStateEnum() { + } + + /** + * Creates or finds a PowerStateEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding PowerStateEnum. + */ + public static PowerStateEnum fromString(String name) { + return fromString(name, PowerStateEnum.class); + } + + /** + * Gets known PowerStateEnum values. + * + * @return known PowerStateEnum values. + */ + public static Collection values() { + return values(PowerStateEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ProvisioningAction.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ProvisioningAction.java new file mode 100644 index 000000000000..81f62a412bee --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ProvisioningAction.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the different types of operations for guest agent. + */ +public final class ProvisioningAction extends ExpandableStringEnum { + /** + * Install guest agent. + */ + public static final ProvisioningAction INSTALL = fromString("install"); + + /** + * Uninstall guest agent. + */ + public static final ProvisioningAction UNINSTALL = fromString("uninstall"); + + /** + * Repair guest agent. + */ + public static final ProvisioningAction REPAIR = fromString("repair"); + + /** + * Creates a new instance of ProvisioningAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningAction() { + } + + /** + * Creates or finds a ProvisioningAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningAction. + */ + public static ProvisioningAction fromString(String name) { + return fromString(name, ProvisioningAction.class); + } + + /** + * Gets known ProvisioningAction values. + * + * @return known ProvisioningAction values. + */ + public static Collection values() { + return values(ProvisioningAction.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ProvisioningStateEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ProvisioningStateEnum.java new file mode 100644 index 000000000000..cfd59e7d594e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/ProvisioningStateEnum.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Provisioning state of the resource. + */ +public final class ProvisioningStateEnum extends ExpandableStringEnum { + /** + * Provisioning has succeeded. + */ + public static final ProvisioningStateEnum SUCCEEDED = fromString("Succeeded"); + + /** + * Provisioning has failed. + */ + public static final ProvisioningStateEnum FAILED = fromString("Failed"); + + /** + * Provisioning is in progress. + */ + public static final ProvisioningStateEnum IN_PROGRESS = fromString("InProgress"); + + /** + * Provisioning has been accepted. + */ + public static final ProvisioningStateEnum ACCEPTED = fromString("Accepted"); + + /** + * Deletion of the resource is in progress. + */ + public static final ProvisioningStateEnum DELETING = fromString("Deleting"); + + /** + * Provisioning has been canceled. + */ + public static final ProvisioningStateEnum CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ProvisioningStateEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningStateEnum() { + } + + /** + * Creates or finds a ProvisioningStateEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningStateEnum. + */ + public static ProvisioningStateEnum fromString(String name) { + return fromString(name, ProvisioningStateEnum.class); + } + + /** + * Gets known ProvisioningStateEnum values. + * + * @return known ProvisioningStateEnum values. + */ + public static Collection values() { + return values(ProvisioningStateEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Route.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Route.java new file mode 100644 index 000000000000..cab8716b6b0b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Route.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.RouteProperties; +import java.io.IOException; + +/** + * Route - Route resource. + */ +@Fluent +public final class Route implements JsonSerializable { + /* + * Properties of the route. + */ + private RouteProperties innerProperties; + + /* + * Name - name of the subnet + */ + private String name; + + /** + * Creates an instance of Route class. + */ + public Route() { + } + + /** + * Get the innerProperties property: Properties of the route. + * + * @return the innerProperties value. + */ + private RouteProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the name property: Name - name of the subnet. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name - name of the subnet. + * + * @param name the name value to set. + * @return the Route object itself. + */ + public Route withName(String name) { + this.name = name; + return this; + } + + /** + * Get the addressPrefix property: The destination CIDR to which the route applies. + * + * @return the addressPrefix value. + */ + public String addressPrefix() { + return this.innerProperties() == null ? null : this.innerProperties().addressPrefix(); + } + + /** + * Set the addressPrefix property: The destination CIDR to which the route applies. + * + * @param addressPrefix the addressPrefix value to set. + * @return the Route object itself. + */ + public Route withAddressPrefix(String addressPrefix) { + if (this.innerProperties() == null) { + this.innerProperties = new RouteProperties(); + } + this.innerProperties().withAddressPrefix(addressPrefix); + return this; + } + + /** + * Get the nextHopIpAddress property: The IP address packets should be forwarded to. Next hop values are only + * allowed in routes where the next hop type is VirtualAppliance. + * + * @return the nextHopIpAddress value. + */ + public String nextHopIpAddress() { + return this.innerProperties() == null ? null : this.innerProperties().nextHopIpAddress(); + } + + /** + * Set the nextHopIpAddress property: The IP address packets should be forwarded to. Next hop values are only + * allowed in routes where the next hop type is VirtualAppliance. + * + * @param nextHopIpAddress the nextHopIpAddress value to set. + * @return the Route object itself. + */ + public Route withNextHopIpAddress(String nextHopIpAddress) { + if (this.innerProperties() == null) { + this.innerProperties = new RouteProperties(); + } + this.innerProperties().withNextHopIpAddress(nextHopIpAddress); + 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); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Route from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Route 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 Route. + */ + public static Route fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Route deserializedRoute = new Route(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedRoute.innerProperties = RouteProperties.fromJson(reader); + } else if ("name".equals(fieldName)) { + deserializedRoute.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRoute; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/RouteTable.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/RouteTable.java new file mode 100644 index 000000000000..eccc02815f45 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/RouteTable.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.RouteTableProperties; +import java.io.IOException; +import java.util.List; + +/** + * Route table resource. + */ +@Fluent +public final class RouteTable implements JsonSerializable { + /* + * A unique read-only string that changes whenever the resource is updated. + */ + private String etag; + + /* + * Resource name. + */ + private String name; + + /* + * Resource type. + */ + private String type; + + /* + * Properties of the route table. + */ + private RouteTableProperties innerProperties; + + /** + * Creates an instance of RouteTable class. + */ + public RouteTable() { + } + + /** + * Get the etag property: A unique read-only string that changes whenever the resource is updated. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the name property: Resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the innerProperties property: Properties of the route table. + * + * @return the innerProperties value. + */ + private RouteTableProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the routes property: Collection of routes contained within a route table. + * + * @return the routes value. + */ + public List routes() { + return this.innerProperties() == null ? null : this.innerProperties().routes(); + } + + /** + * Set the routes property: Collection of routes contained within a route table. + * + * @param routes the routes value to set. + * @return the RouteTable object itself. + */ + public RouteTable withRoutes(List routes) { + if (this.innerProperties() == null) { + this.innerProperties = new RouteTableProperties(); + } + this.innerProperties().withRoutes(routes); + 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 RouteTable from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RouteTable 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 RouteTable. + */ + public static RouteTable fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RouteTable deserializedRouteTable = new RouteTable(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("etag".equals(fieldName)) { + deserializedRouteTable.etag = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRouteTable.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRouteTable.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedRouteTable.innerProperties = RouteTableProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRouteTable; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityEncryptionType.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityEncryptionType.java new file mode 100644 index 000000000000..193b2a2c313d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityEncryptionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Encryption type of the managed disk enum. + */ +public final class SecurityEncryptionType extends ExpandableStringEnum { + /** + * Non-persisted TPM encryption type. + */ + public static final SecurityEncryptionType NON_PERSISTED_TPM = fromString("NonPersistedTPM"); + + /** + * Creates a new instance of SecurityEncryptionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecurityEncryptionType() { + } + + /** + * Creates or finds a SecurityEncryptionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityEncryptionType. + */ + public static SecurityEncryptionType fromString(String name) { + return fromString(name, SecurityEncryptionType.class); + } + + /** + * Gets known SecurityEncryptionType values. + * + * @return known SecurityEncryptionType values. + */ + public static Collection values() { + return values(SecurityEncryptionType.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRule.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRule.java new file mode 100644 index 000000000000..2051ce4943b9 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRule.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.SecurityRuleInner; + +/** + * An immutable client-side representation of SecurityRule. + */ +public interface SecurityRule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + SecurityRuleProperties properties(); + + /** + * Gets the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.SecurityRuleInner object. + * + * @return the inner object. + */ + SecurityRuleInner innerModel(); + + /** + * The entirety of the SecurityRule definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The SecurityRule definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the SecurityRule definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the SecurityRule definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, networkSecurityGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @return the next definition stage. + */ + WithCreate withExistingNetworkSecurityGroup(String resourceGroupName, String networkSecurityGroupName); + } + + /** + * The stage of the SecurityRule definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties, DefinitionStages.WithExtendedLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + SecurityRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + SecurityRule create(Context context); + } + + /** + * The stage of the SecurityRule definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(SecurityRuleProperties properties); + } + + /** + * The stage of the SecurityRule definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extendedLocation of the resource.. + * + * @param extendedLocation The extendedLocation of the resource. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + } + + /** + * Begins update for the SecurityRule resource. + * + * @return the stage of resource update. + */ + SecurityRule.Update update(); + + /** + * The template for SecurityRule update. + */ + interface Update extends UpdateStages.WithProperties, UpdateStages.WithExtendedLocation { + /** + * Executes the update request. + * + * @return the updated resource. + */ + SecurityRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + SecurityRule apply(Context context); + } + + /** + * The SecurityRule update stages. + */ + interface UpdateStages { + /** + * The stage of the SecurityRule update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(SecurityRuleProperties properties); + } + + /** + * The stage of the SecurityRule update allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extendedLocation of the resource.. + * + * @param extendedLocation The extendedLocation of the resource. + * @return the next definition stage. + */ + Update withExtendedLocation(ExtendedLocation extendedLocation); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + SecurityRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + SecurityRule refresh(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleAccess.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleAccess.java new file mode 100644 index 000000000000..95c9bb2e1a91 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleAccess.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Whether network traffic is allowed or denied. + */ +public final class SecurityRuleAccess extends ExpandableStringEnum { + /** + * Network traffic is allowed. + */ + public static final SecurityRuleAccess ALLOW = fromString("Allow"); + + /** + * Network traffic is denied. + */ + public static final SecurityRuleAccess DENY = fromString("Deny"); + + /** + * Creates a new instance of SecurityRuleAccess value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecurityRuleAccess() { + } + + /** + * Creates or finds a SecurityRuleAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityRuleAccess. + */ + public static SecurityRuleAccess fromString(String name) { + return fromString(name, SecurityRuleAccess.class); + } + + /** + * Gets known SecurityRuleAccess values. + * + * @return known SecurityRuleAccess values. + */ + public static Collection values() { + return values(SecurityRuleAccess.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleDirection.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleDirection.java new file mode 100644 index 000000000000..5fa971798635 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleDirection.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. + */ +public final class SecurityRuleDirection extends ExpandableStringEnum { + /** + * Rule is evaluated on incoming traffic. + */ + public static final SecurityRuleDirection INBOUND = fromString("Inbound"); + + /** + * Rule is evaluated on outgoing traffic. + */ + public static final SecurityRuleDirection OUTBOUND = fromString("Outbound"); + + /** + * Creates a new instance of SecurityRuleDirection value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecurityRuleDirection() { + } + + /** + * Creates or finds a SecurityRuleDirection from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityRuleDirection. + */ + public static SecurityRuleDirection fromString(String name) { + return fromString(name, SecurityRuleDirection.class); + } + + /** + * Gets known SecurityRuleDirection values. + * + * @return known SecurityRuleDirection values. + */ + public static Collection values() { + return values(SecurityRuleDirection.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleProperties.java new file mode 100644 index 000000000000..e12cbc0f0a42 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleProperties.java @@ -0,0 +1,373 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Security rule resource. + */ +@Fluent +public final class SecurityRuleProperties implements JsonSerializable { + /* + * A description for this rule. Restricted to 140 chars. + */ + private String description; + + /* + * Network protocol this rule applies to. + */ + private SecurityRuleProtocol protocol; + + /* + * The CIDR or source IP ranges. + */ + private List sourceAddressPrefixes; + + /* + * The destination address prefixes. CIDR or destination IP ranges. + */ + private List destinationAddressPrefixes; + + /* + * The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all ports. + */ + private List sourcePortRanges; + + /* + * The destination port ranges. Integer or range between 0 and 65535. Asterisk '*' can also be used to match all + * ports. + */ + private List destinationPortRanges; + + /* + * The network traffic is allowed or denied. + */ + private SecurityRuleAccess access; + + /* + * The priority of the rule. The value can be between 100 and 4096. The priority number must be unique for each rule + * in the collection. The lower the priority number, the higher the priority of the rule. + */ + private int priority; + + /* + * The direction of the rule. The direction specifies if rule will be evaluated on incoming or outgoing traffic. + */ + private SecurityRuleDirection direction; + + /* + * Provisioning state of the SR + */ + private ProvisioningStateEnum provisioningState; + + /** + * Creates an instance of SecurityRuleProperties class. + */ + public SecurityRuleProperties() { + } + + /** + * Get the description property: A description for this rule. Restricted to 140 chars. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description for this rule. Restricted to 140 chars. + * + * @param description the description value to set. + * @return the SecurityRuleProperties object itself. + */ + public SecurityRuleProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the protocol property: Network protocol this rule applies to. + * + * @return the protocol value. + */ + public SecurityRuleProtocol protocol() { + return this.protocol; + } + + /** + * Set the protocol property: Network protocol this rule applies to. + * + * @param protocol the protocol value to set. + * @return the SecurityRuleProperties object itself. + */ + public SecurityRuleProperties withProtocol(SecurityRuleProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get the sourceAddressPrefixes property: The CIDR or source IP ranges. + * + * @return the sourceAddressPrefixes value. + */ + public List sourceAddressPrefixes() { + return this.sourceAddressPrefixes; + } + + /** + * Set the sourceAddressPrefixes property: The CIDR or source IP ranges. + * + * @param sourceAddressPrefixes the sourceAddressPrefixes value to set. + * @return the SecurityRuleProperties object itself. + */ + public SecurityRuleProperties withSourceAddressPrefixes(List sourceAddressPrefixes) { + this.sourceAddressPrefixes = sourceAddressPrefixes; + return this; + } + + /** + * Get the destinationAddressPrefixes property: The destination address prefixes. CIDR or destination IP ranges. + * + * @return the destinationAddressPrefixes value. + */ + public List destinationAddressPrefixes() { + return this.destinationAddressPrefixes; + } + + /** + * Set the destinationAddressPrefixes property: The destination address prefixes. CIDR or destination IP ranges. + * + * @param destinationAddressPrefixes the destinationAddressPrefixes value to set. + * @return the SecurityRuleProperties object itself. + */ + public SecurityRuleProperties withDestinationAddressPrefixes(List destinationAddressPrefixes) { + this.destinationAddressPrefixes = destinationAddressPrefixes; + return this; + } + + /** + * Get the sourcePortRanges property: The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can + * also be used to match all ports. + * + * @return the sourcePortRanges value. + */ + public List sourcePortRanges() { + return this.sourcePortRanges; + } + + /** + * Set the sourcePortRanges property: The source port ranges. Integer or range between 0 and 65535. Asterisk '*' can + * also be used to match all ports. + * + * @param sourcePortRanges the sourcePortRanges value to set. + * @return the SecurityRuleProperties object itself. + */ + public SecurityRuleProperties withSourcePortRanges(List sourcePortRanges) { + this.sourcePortRanges = sourcePortRanges; + return this; + } + + /** + * Get the destinationPortRanges property: The destination port ranges. Integer or range between 0 and 65535. + * Asterisk '*' can also be used to match all ports. + * + * @return the destinationPortRanges value. + */ + public List destinationPortRanges() { + return this.destinationPortRanges; + } + + /** + * Set the destinationPortRanges property: The destination port ranges. Integer or range between 0 and 65535. + * Asterisk '*' can also be used to match all ports. + * + * @param destinationPortRanges the destinationPortRanges value to set. + * @return the SecurityRuleProperties object itself. + */ + public SecurityRuleProperties withDestinationPortRanges(List destinationPortRanges) { + this.destinationPortRanges = destinationPortRanges; + return this; + } + + /** + * Get the access property: The network traffic is allowed or denied. + * + * @return the access value. + */ + public SecurityRuleAccess access() { + return this.access; + } + + /** + * Set the access property: The network traffic is allowed or denied. + * + * @param access the access value to set. + * @return the SecurityRuleProperties object itself. + */ + public SecurityRuleProperties withAccess(SecurityRuleAccess access) { + this.access = access; + return this; + } + + /** + * Get the priority property: The priority of the rule. The value can be between 100 and 4096. The priority number + * must be unique for each rule in the collection. The lower the priority number, the higher the priority of the + * rule. + * + * @return the priority value. + */ + public int priority() { + return this.priority; + } + + /** + * Set the priority property: The priority of the rule. The value can be between 100 and 4096. The priority number + * must be unique for each rule in the collection. The lower the priority number, the higher the priority of the + * rule. + * + * @param priority the priority value to set. + * @return the SecurityRuleProperties object itself. + */ + public SecurityRuleProperties withPriority(int priority) { + this.priority = priority; + return this; + } + + /** + * Get the direction property: The direction of the rule. The direction specifies if rule will be evaluated on + * incoming or outgoing traffic. + * + * @return the direction value. + */ + public SecurityRuleDirection direction() { + return this.direction; + } + + /** + * Set the direction property: The direction of the rule. The direction specifies if rule will be evaluated on + * incoming or outgoing traffic. + * + * @param direction the direction value to set. + * @return the SecurityRuleProperties object itself. + */ + public SecurityRuleProperties withDirection(SecurityRuleDirection direction) { + this.direction = direction; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the SR. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (protocol() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property protocol in model SecurityRuleProperties")); + } + if (access() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property access in model SecurityRuleProperties")); + } + if (direction() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property direction in model SecurityRuleProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityRuleProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("protocol", this.protocol == null ? null : this.protocol.toString()); + jsonWriter.writeStringField("access", this.access == null ? null : this.access.toString()); + jsonWriter.writeIntField("priority", this.priority); + jsonWriter.writeStringField("direction", this.direction == null ? null : this.direction.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeArrayField("sourceAddressPrefixes", this.sourceAddressPrefixes, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("destinationAddressPrefixes", this.destinationAddressPrefixes, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("sourcePortRanges", this.sourcePortRanges, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("destinationPortRanges", this.destinationPortRanges, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityRuleProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityRuleProperties 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 SecurityRuleProperties. + */ + public static SecurityRuleProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityRuleProperties deserializedSecurityRuleProperties = new SecurityRuleProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("protocol".equals(fieldName)) { + deserializedSecurityRuleProperties.protocol = SecurityRuleProtocol.fromString(reader.getString()); + } else if ("access".equals(fieldName)) { + deserializedSecurityRuleProperties.access = SecurityRuleAccess.fromString(reader.getString()); + } else if ("priority".equals(fieldName)) { + deserializedSecurityRuleProperties.priority = reader.getInt(); + } else if ("direction".equals(fieldName)) { + deserializedSecurityRuleProperties.direction = SecurityRuleDirection.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedSecurityRuleProperties.description = reader.getString(); + } else if ("sourceAddressPrefixes".equals(fieldName)) { + List sourceAddressPrefixes = reader.readArray(reader1 -> reader1.getString()); + deserializedSecurityRuleProperties.sourceAddressPrefixes = sourceAddressPrefixes; + } else if ("destinationAddressPrefixes".equals(fieldName)) { + List destinationAddressPrefixes = reader.readArray(reader1 -> reader1.getString()); + deserializedSecurityRuleProperties.destinationAddressPrefixes = destinationAddressPrefixes; + } else if ("sourcePortRanges".equals(fieldName)) { + List sourcePortRanges = reader.readArray(reader1 -> reader1.getString()); + deserializedSecurityRuleProperties.sourcePortRanges = sourcePortRanges; + } else if ("destinationPortRanges".equals(fieldName)) { + List destinationPortRanges = reader.readArray(reader1 -> reader1.getString()); + deserializedSecurityRuleProperties.destinationPortRanges = destinationPortRanges; + } else if ("provisioningState".equals(fieldName)) { + deserializedSecurityRuleProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityRuleProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleProtocol.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleProtocol.java new file mode 100644 index 000000000000..9637453bdf33 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRuleProtocol.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Network protocol this rule applies to. + */ +public final class SecurityRuleProtocol extends ExpandableStringEnum { + /** + * Transmission Control Protocol. + */ + public static final SecurityRuleProtocol TCP = fromString("Tcp"); + + /** + * User Datagram Protocol. + */ + public static final SecurityRuleProtocol UDP = fromString("Udp"); + + /** + * Internet Control Message Protocol. + */ + public static final SecurityRuleProtocol ICMP = fromString("Icmp"); + + /** + * Wildcard rule for all protocols. + */ + public static final SecurityRuleProtocol ASTERISK = fromString("*"); + + /** + * Creates a new instance of SecurityRuleProtocol value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecurityRuleProtocol() { + } + + /** + * Creates or finds a SecurityRuleProtocol from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityRuleProtocol. + */ + public static SecurityRuleProtocol fromString(String name) { + return fromString(name, SecurityRuleProtocol.class); + } + + /** + * Gets known SecurityRuleProtocol values. + * + * @return known SecurityRuleProtocol values. + */ + public static Collection values() { + return values(SecurityRuleProtocol.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRules.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRules.java new file mode 100644 index 000000000000..fccf15836b83 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityRules.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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 SecurityRules. + */ +public interface SecurityRules { + /** + * Gets the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified security rule along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String networkSecurityGroupName, + String securityRuleName, Context context); + + /** + * Gets the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified security rule. + */ + SecurityRule get(String resourceGroupName, String networkSecurityGroupName, String securityRuleName); + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkSecurityGroupName, String securityRuleName); + + /** + * Deletes the specified security rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param securityRuleName Name of the security rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 networkSecurityGroupName, String securityRuleName, Context context); + + /** + * Gets all security rules in a Network Security Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByNetworkSecurityGroup(String resourceGroupName, String networkSecurityGroupName); + + /** + * Gets all security rules in a Network Security Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param networkSecurityGroupName Name of the network security group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all security rules in a Network Security Group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByNetworkSecurityGroup(String resourceGroupName, String networkSecurityGroupName, + Context context); + + /** + * Gets the specified security rule. + * + * @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 the specified security rule along with {@link Response}. + */ + SecurityRule getById(String id); + + /** + * Gets the specified security rule. + * + * @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 the specified security rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified security rule. + * + * @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); + + /** + * Deletes the specified security rule. + * + * @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 SecurityRule resource. + * + * @param name resource name. + * @return the first stage of the new SecurityRule definition. + */ + SecurityRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityTypes.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityTypes.java new file mode 100644 index 000000000000..f0e02f331a58 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SecurityTypes.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for + * SecurityType to function. + */ +public final class SecurityTypes extends ExpandableStringEnum { + /** + * Trusted Launch security type. + */ + public static final SecurityTypes TRUSTED_LAUNCH = fromString("TrustedLaunch"); + + /** + * Confidential VM security type. + */ + public static final SecurityTypes CONFIDENTIAL_VM = fromString("ConfidentialVM"); + + /** + * Creates a new instance of SecurityTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecurityTypes() { + } + + /** + * Creates or finds a SecurityTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityTypes. + */ + public static SecurityTypes fromString(String name) { + return fromString(name, SecurityTypes.class); + } + + /** + * Gets known SecurityTypes values. + * + * @return known SecurityTypes values. + */ + public static Collection values() { + return values(SecurityTypes.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SshConfiguration.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SshConfiguration.java new file mode 100644 index 000000000000..0b4949d95729 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SshConfiguration.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * SSH configuration for Linux based VMs running on Azure. + */ +@Fluent +public final class SshConfiguration implements JsonSerializable { + /* + * The list of SSH public keys used to authenticate with linux based VMs. + */ + private List publicKeys; + + /** + * Creates an instance of SshConfiguration class. + */ + public SshConfiguration() { + } + + /** + * Get the publicKeys property: The list of SSH public keys used to authenticate with linux based VMs. + * + * @return the publicKeys value. + */ + public List publicKeys() { + return this.publicKeys; + } + + /** + * Set the publicKeys property: The list of SSH public keys used to authenticate with linux based VMs. + * + * @param publicKeys the publicKeys value to set. + * @return the SshConfiguration object itself. + */ + public SshConfiguration withPublicKeys(List publicKeys) { + this.publicKeys = publicKeys; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (publicKeys() != null) { + publicKeys().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("publicKeys", this.publicKeys, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SshConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SshConfiguration 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 SshConfiguration. + */ + public static SshConfiguration fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SshConfiguration deserializedSshConfiguration = new SshConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("publicKeys".equals(fieldName)) { + List publicKeys = reader.readArray(reader1 -> SshPublicKey.fromJson(reader1)); + deserializedSshConfiguration.publicKeys = publicKeys; + } else { + reader.skipChildren(); + } + } + + return deserializedSshConfiguration; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SshPublicKey.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SshPublicKey.java new file mode 100644 index 000000000000..cf4407fb0953 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SshPublicKey.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Contains information about SSH certificate public key and the path on the Linux VM where the public key is placed. + */ +@Fluent +public final class SshPublicKey implements JsonSerializable { + /* + * Specifies the full path on the created VM where ssh public key is stored. If the file already exists, the + * specified key is appended to the file. Example: /home/user/.ssh/authorized_keys + */ + private String path; + + /* + * SSH public key certificate used to authenticate with the VM through ssh. The key needs to be at least 2048-bit + * and in ssh-rsa format.

For creating ssh keys, see [Create SSH keys on Linux and Mac for Linux VMs in + * Azure]https://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + */ + private String keyData; + + /** + * Creates an instance of SshPublicKey class. + */ + public SshPublicKey() { + } + + /** + * Get the path property: Specifies the full path on the created VM where ssh public key is stored. If the file + * already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: Specifies the full path on the created VM where ssh public key is stored. If the file + * already exists, the specified key is appended to the file. Example: /home/user/.ssh/authorized_keys. + * + * @param path the path value to set. + * @return the SshPublicKey object itself. + */ + public SshPublicKey withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the keyData property: SSH public key certificate used to authenticate with the VM through ssh. The key needs + * to be at least 2048-bit and in ssh-rsa format. <br><br> For creating ssh keys, see [Create SSH keys + * on Linux and Mac for Linux VMs in + * Azure]https://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + * + * @return the keyData value. + */ + public String keyData() { + return this.keyData; + } + + /** + * Set the keyData property: SSH public key certificate used to authenticate with the VM through ssh. The key needs + * to be at least 2048-bit and in ssh-rsa format. <br><br> For creating ssh keys, see [Create SSH keys + * on Linux and Mac for Linux VMs in + * Azure]https://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). + * + * @param keyData the keyData value to set. + * @return the SshPublicKey object itself. + */ + public SshPublicKey withKeyData(String keyData) { + this.keyData = keyData; + 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("path", this.path); + jsonWriter.writeStringField("keyData", this.keyData); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SshPublicKey from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SshPublicKey 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 SshPublicKey. + */ + public static SshPublicKey fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SshPublicKey deserializedSshPublicKey = new SshPublicKey(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("path".equals(fieldName)) { + deserializedSshPublicKey.path = reader.getString(); + } else if ("keyData".equals(fieldName)) { + deserializedSshPublicKey.keyData = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSshPublicKey; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Status.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Status.java new file mode 100644 index 000000000000..fd0bbc063f0d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Status.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the operation performed on the resource [Succeeded, Failed, InProgress]. + */ +public final class Status extends ExpandableStringEnum { + /** + * Operation succeeded. + */ + public static final Status SUCCEEDED = fromString("Succeeded"); + + /** + * Operation failed. + */ + public static final Status FAILED = fromString("Failed"); + + /** + * Operation is in progress. + */ + public static final Status IN_PROGRESS = fromString("InProgress"); + + /** + * Creates a new instance of Status value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Status() { + } + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** + * Gets known Status values. + * + * @return known Status values. + */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StatusLevelTypes.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StatusLevelTypes.java new file mode 100644 index 000000000000..a3d01352830c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StatusLevelTypes.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The level code. + */ +public final class StatusLevelTypes extends ExpandableStringEnum { + /** + * Informational status level. + */ + public static final StatusLevelTypes INFO = fromString("Info"); + + /** + * Warning status level. + */ + public static final StatusLevelTypes WARNING = fromString("Warning"); + + /** + * Error status level. + */ + public static final StatusLevelTypes ERROR = fromString("Error"); + + /** + * Creates a new instance of StatusLevelTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StatusLevelTypes() { + } + + /** + * Creates or finds a StatusLevelTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding StatusLevelTypes. + */ + public static StatusLevelTypes fromString(String name) { + return fromString(name, StatusLevelTypes.class); + } + + /** + * Gets known StatusLevelTypes values. + * + * @return known StatusLevelTypes values. + */ + public static Collection values() { + return values(StatusLevelTypes.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StatusTypes.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StatusTypes.java new file mode 100644 index 000000000000..1d727b80de40 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StatusTypes.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The installation status of the hybrid machine agent installation. + */ +public final class StatusTypes extends ExpandableStringEnum { + /** + * Installation succeeded. + */ + public static final StatusTypes SUCCEEDED = fromString("Succeeded"); + + /** + * Installation in progress. + */ + public static final StatusTypes IN_PROGRESS = fromString("InProgress"); + + /** + * Installation failed. + */ + public static final StatusTypes FAILED = fromString("Failed"); + + /** + * Creates a new instance of StatusTypes value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StatusTypes() { + } + + /** + * Creates or finds a StatusTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding StatusTypes. + */ + public static StatusTypes fromString(String name) { + return fromString(name, StatusTypes.class); + } + + /** + * Gets known StatusTypes values. + * + * @return known StatusTypes values. + */ + public static Collection values() { + return values(StatusTypes.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainer.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainer.java new file mode 100644 index 000000000000..e87aea7d2dd9 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainer.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.StorageContainerInner; +import java.util.Map; + +/** + * An immutable client-side representation of StorageContainer. + */ +public interface StorageContainer { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + StorageContainerProperties properties(); + + /** + * Gets the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.StorageContainerInner object. + * + * @return the inner object. + */ + StorageContainerInner innerModel(); + + /** + * The entirety of the StorageContainer definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The StorageContainer definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the StorageContainer definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the StorageContainer 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 StorageContainer 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 StorageContainer definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithExtendedLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + StorageContainer create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + StorageContainer create(Context context); + } + + /** + * The stage of the StorageContainer 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 StorageContainer definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(StorageContainerProperties properties); + } + + /** + * The stage of the StorageContainer definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extendedLocation of the resource.. + * + * @param extendedLocation The extendedLocation of the resource. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + } + + /** + * Begins update for the StorageContainer resource. + * + * @return the stage of resource update. + */ + StorageContainer.Update update(); + + /** + * The template for StorageContainer update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + StorageContainer apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + StorageContainer apply(Context context); + } + + /** + * The StorageContainer update stages. + */ + interface UpdateStages { + /** + * The stage of the StorageContainer 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); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + StorageContainer refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + StorageContainer refresh(Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerProperties.java new file mode 100644 index 000000000000..82d4572edcee --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerProperties.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Properties under the storage container resource. + */ +@Fluent +public final class StorageContainerProperties implements JsonSerializable { + /* + * Path of the storage container on the disk + */ + private String path; + + /* + * Provisioning state of the storage container. + */ + private ProvisioningStateEnum provisioningState; + + /* + * The observed state of storage containers + */ + private StorageContainerStatus status; + + /** + * Creates an instance of StorageContainerProperties class. + */ + public StorageContainerProperties() { + } + + /** + * Get the path property: Path of the storage container on the disk. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: Path of the storage container on the disk. + * + * @param path the path value to set. + * @return the StorageContainerProperties object itself. + */ + public StorageContainerProperties withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the storage container. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Get the status property: The observed state of storage containers. + * + * @return the status value. + */ + public StorageContainerStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (path() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property path in model StorageContainerProperties")); + } + if (status() != null) { + status().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(StorageContainerProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("path", this.path); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageContainerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageContainerProperties 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 StorageContainerProperties. + */ + public static StorageContainerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageContainerProperties deserializedStorageContainerProperties = new StorageContainerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("path".equals(fieldName)) { + deserializedStorageContainerProperties.path = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedStorageContainerProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedStorageContainerProperties.status = StorageContainerStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageContainerProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerStatus.java new file mode 100644 index 000000000000..28f6cf8f1822 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerStatus.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The observed state of storage containers. + */ +@Immutable +public final class StorageContainerStatus implements JsonSerializable { + /* + * StorageContainer provisioning error code + */ + private String errorCode; + + /* + * Descriptive error message + */ + private String errorMessage; + + /* + * Amount of space available on the disk in MB + */ + private Long availableSizeMB; + + /* + * Total size of the disk in MB + */ + private Long containerSizeMB; + + /* + * Storage container's provisioning status + */ + private StorageContainerStatusProvisioningStatus provisioningStatus; + + /** + * Creates an instance of StorageContainerStatus class. + */ + private StorageContainerStatus() { + } + + /** + * Get the errorCode property: StorageContainer provisioning error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: Descriptive error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the availableSizeMB property: Amount of space available on the disk in MB. + * + * @return the availableSizeMB value. + */ + public Long availableSizeMB() { + return this.availableSizeMB; + } + + /** + * Get the containerSizeMB property: Total size of the disk in MB. + * + * @return the containerSizeMB value. + */ + public Long containerSizeMB() { + return this.containerSizeMB; + } + + /** + * Get the provisioningStatus property: Storage container's provisioning status. + * + * @return the provisioningStatus value. + */ + public StorageContainerStatusProvisioningStatus provisioningStatus() { + return this.provisioningStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provisioningStatus() != null) { + provisioningStatus().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeNumberField("availableSizeMB", this.availableSizeMB); + jsonWriter.writeNumberField("containerSizeMB", this.containerSizeMB); + jsonWriter.writeJsonField("provisioningStatus", this.provisioningStatus); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageContainerStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageContainerStatus 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 StorageContainerStatus. + */ + public static StorageContainerStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageContainerStatus deserializedStorageContainerStatus = new StorageContainerStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedStorageContainerStatus.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedStorageContainerStatus.errorMessage = reader.getString(); + } else if ("availableSizeMB".equals(fieldName)) { + deserializedStorageContainerStatus.availableSizeMB = reader.getNullable(JsonReader::getLong); + } else if ("containerSizeMB".equals(fieldName)) { + deserializedStorageContainerStatus.containerSizeMB = reader.getNullable(JsonReader::getLong); + } else if ("provisioningStatus".equals(fieldName)) { + deserializedStorageContainerStatus.provisioningStatus + = StorageContainerStatusProvisioningStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageContainerStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerStatusProvisioningStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerStatusProvisioningStatus.java new file mode 100644 index 000000000000..d1ec13c8d397 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerStatusProvisioningStatus.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Storage container provisioning status. + */ +@Immutable +public final class StorageContainerStatusProvisioningStatus + implements JsonSerializable { + /* + * The ID of the operation performed on the storage container + */ + private String operationId; + + /* + * The status of the operation performed on the storage container [Succeeded, Failed, InProgress] + */ + private Status status; + + /** + * Creates an instance of StorageContainerStatusProvisioningStatus class. + */ + private StorageContainerStatusProvisioningStatus() { + } + + /** + * Get the operationId property: The ID of the operation performed on the storage container. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the status property: The status of the operation performed on the storage container [Succeeded, Failed, + * InProgress]. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * 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("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageContainerStatusProvisioningStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageContainerStatusProvisioningStatus 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 StorageContainerStatusProvisioningStatus. + */ + public static StorageContainerStatusProvisioningStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageContainerStatusProvisioningStatus deserializedStorageContainerStatusProvisioningStatus + = new StorageContainerStatusProvisioningStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + deserializedStorageContainerStatusProvisioningStatus.operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedStorageContainerStatusProvisioningStatus.status = Status.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageContainerStatusProvisioningStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerTagsUpdate.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerTagsUpdate.java new file mode 100644 index 000000000000..49142605e75b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainerTagsUpdate.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The type used for updating tags in StorageContainer resources. + */ +@Fluent +public final class StorageContainerTagsUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of StorageContainerTagsUpdate class. + */ + public StorageContainerTagsUpdate() { + } + + /** + * 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 StorageContainerTagsUpdate object itself. + */ + public StorageContainerTagsUpdate withTags(Map tags) { + this.tags = tags; + 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.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageContainerTagsUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageContainerTagsUpdate 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 StorageContainerTagsUpdate. + */ + public static StorageContainerTagsUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageContainerTagsUpdate deserializedStorageContainerTagsUpdate = new StorageContainerTagsUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedStorageContainerTagsUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedStorageContainerTagsUpdate; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainers.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainers.java new file mode 100644 index 000000000000..5491814983b9 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageContainers.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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 StorageContainers. + */ +public interface StorageContainers { + /** + * Gets a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 storage container along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String storageContainerName, + Context context); + + /** + * Gets a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 storage container. + */ + StorageContainer getByResourceGroup(String resourceGroupName, String storageContainerName); + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 storageContainerName); + + /** + * The operation to delete a storage container. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName Name of the storage container. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 storageContainerName, Context context); + + /** + * Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @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 StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the storage containers in the specified resource group. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @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 StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the storage containers in the specified subscription. Use the nextLink property in the response to + * get the next page of storage containers. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a storage container. + * + * @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 storage container along with {@link Response}. + */ + StorageContainer getById(String id); + + /** + * Gets a storage container. + * + * @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 storage container along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The operation to delete a storage container. + * + * @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); + + /** + * The operation to delete a storage container. + * + * @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 StorageContainer resource. + * + * @param name resource name. + * @return the first stage of the new StorageContainer definition. + */ + StorageContainer.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageProfileUpdate.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageProfileUpdate.java new file mode 100644 index 000000000000..55d65a2dedba --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/StorageProfileUpdate.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Storage profile update. + */ +@Fluent +public final class StorageProfileUpdate implements JsonSerializable { + /* + * adds data disks to the virtual machine instance for the update call + */ + private List dataDisks; + + /** + * Creates an instance of StorageProfileUpdate class. + */ + public StorageProfileUpdate() { + } + + /** + * Get the dataDisks property: adds data disks to the virtual machine instance for the update call. + * + * @return the dataDisks value. + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set the dataDisks property: adds data disks to the virtual machine instance for the update call. + * + * @param dataDisks the dataDisks value to set. + * @return the StorageProfileUpdate object itself. + */ + public StorageProfileUpdate withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataDisks() != null) { + dataDisks().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("dataDisks", this.dataDisks, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageProfileUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageProfileUpdate 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 StorageProfileUpdate. + */ + public static StorageProfileUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageProfileUpdate deserializedStorageProfileUpdate = new StorageProfileUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataDisks".equals(fieldName)) { + List dataDisks + = reader.readArray(reader1 -> VirtualHardDiskArmReference.fromJson(reader1)); + deserializedStorageProfileUpdate.dataDisks = dataDisks; + } else { + reader.skipChildren(); + } + } + + return deserializedStorageProfileUpdate; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Subnet.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Subnet.java new file mode 100644 index 000000000000..8a53ec12f173 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/Subnet.java @@ -0,0 +1,306 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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.azurestackhci.vm.fluent.models.SubnetProperties; +import java.io.IOException; +import java.util.List; + +/** + * Properties of the subnet. + */ +@Fluent +public final class Subnet implements JsonSerializable { + /* + * Properties of the subnet. + */ + private SubnetProperties innerProperties; + + /* + * Name - The name of the resource that is unique within a resource group. This name can be used to access the + * resource. + */ + private String name; + + /** + * Creates an instance of Subnet class. + */ + public Subnet() { + } + + /** + * Get the innerProperties property: Properties of the subnet. + * + * @return the innerProperties value. + */ + private SubnetProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the name property: Name - The name of the resource that is unique within a resource group. This name can be + * used to access the resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name - The name of the resource that is unique within a resource group. This name can be + * used to access the resource. + * + * @param name the name value to set. + * @return the Subnet object itself. + */ + public Subnet withName(String name) { + this.name = name; + return this; + } + + /** + * Get the addressPrefix property: The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + * + * @return the addressPrefix value. + */ + public String addressPrefix() { + return this.innerProperties() == null ? null : this.innerProperties().addressPrefix(); + } + + /** + * Set the addressPrefix property: The address prefix for the subnet: Cidr for this subnet - IPv4, IPv6. + * + * @param addressPrefix the addressPrefix value to set. + * @return the Subnet object itself. + */ + public Subnet withAddressPrefix(String addressPrefix) { + if (this.innerProperties() == null) { + this.innerProperties = new SubnetProperties(); + } + this.innerProperties().withAddressPrefix(addressPrefix); + return this; + } + + /** + * Get the addressPrefixes property: List of address prefixes for the subnet. + * + * @return the addressPrefixes value. + */ + public List addressPrefixes() { + return this.innerProperties() == null ? null : this.innerProperties().addressPrefixes(); + } + + /** + * Set the addressPrefixes property: List of address prefixes for the subnet. + * + * @param addressPrefixes the addressPrefixes value to set. + * @return the Subnet object itself. + */ + public Subnet withAddressPrefixes(List addressPrefixes) { + if (this.innerProperties() == null) { + this.innerProperties = new SubnetProperties(); + } + this.innerProperties().withAddressPrefixes(addressPrefixes); + return this; + } + + /** + * Get the ipAllocationMethod property: IPAllocationMethod - The IP address allocation method. Possible values + * include: 'Static', 'Dynamic'. + * + * @return the ipAllocationMethod value. + */ + public IpAllocationMethodEnum ipAllocationMethod() { + return this.innerProperties() == null ? null : this.innerProperties().ipAllocationMethod(); + } + + /** + * Set the ipAllocationMethod property: IPAllocationMethod - The IP address allocation method. Possible values + * include: 'Static', 'Dynamic'. + * + * @param ipAllocationMethod the ipAllocationMethod value to set. + * @return the Subnet object itself. + */ + public Subnet withIpAllocationMethod(IpAllocationMethodEnum ipAllocationMethod) { + if (this.innerProperties() == null) { + this.innerProperties = new SubnetProperties(); + } + this.innerProperties().withIpAllocationMethod(ipAllocationMethod); + return this; + } + + /** + * Get the ipConfigurationReferences property: IPConfigurationReferences - list of IPConfigurationReferences. + * + * @return the ipConfigurationReferences value. + */ + public List ipConfigurationReferences() { + return this.innerProperties() == null ? null : this.innerProperties().ipConfigurationReferences(); + } + + /** + * Set the ipConfigurationReferences property: IPConfigurationReferences - list of IPConfigurationReferences. + * + * @param ipConfigurationReferences the ipConfigurationReferences value to set. + * @return the Subnet object itself. + */ + public Subnet withIpConfigurationReferences(List ipConfigurationReferences) { + if (this.innerProperties() == null) { + this.innerProperties = new SubnetProperties(); + } + this.innerProperties().withIpConfigurationReferences(ipConfigurationReferences); + return this; + } + + /** + * Get the networkSecurityGroup property: NetworkSecurityGroup - Network Security Group attached to the logical + * network. + * + * @return the networkSecurityGroup value. + */ + public NetworkSecurityGroupArmReference networkSecurityGroup() { + return this.innerProperties() == null ? null : this.innerProperties().networkSecurityGroup(); + } + + /** + * Set the networkSecurityGroup property: NetworkSecurityGroup - Network Security Group attached to the logical + * network. + * + * @param networkSecurityGroup the networkSecurityGroup value to set. + * @return the Subnet object itself. + */ + public Subnet withNetworkSecurityGroup(NetworkSecurityGroupArmReference networkSecurityGroup) { + if (this.innerProperties() == null) { + this.innerProperties = new SubnetProperties(); + } + this.innerProperties().withNetworkSecurityGroup(networkSecurityGroup); + return this; + } + + /** + * Get the routeTable property: Route table resource. + * + * @return the routeTable value. + */ + public RouteTable routeTable() { + return this.innerProperties() == null ? null : this.innerProperties().routeTable(); + } + + /** + * Set the routeTable property: Route table resource. + * + * @param routeTable the routeTable value to set. + * @return the Subnet object itself. + */ + public Subnet withRouteTable(RouteTable routeTable) { + if (this.innerProperties() == null) { + this.innerProperties = new SubnetProperties(); + } + this.innerProperties().withRouteTable(routeTable); + return this; + } + + /** + * Get the ipPools property: network associated pool of IP Addresses. + * + * @return the ipPools value. + */ + public List ipPools() { + return this.innerProperties() == null ? null : this.innerProperties().ipPools(); + } + + /** + * Set the ipPools property: network associated pool of IP Addresses. + * + * @param ipPools the ipPools value to set. + * @return the Subnet object itself. + */ + public Subnet withIpPools(List ipPools) { + if (this.innerProperties() == null) { + this.innerProperties = new SubnetProperties(); + } + this.innerProperties().withIpPools(ipPools); + return this; + } + + /** + * Get the vlan property: Vlan to use for the subnet. + * + * @return the vlan value. + */ + public Integer vlan() { + return this.innerProperties() == null ? null : this.innerProperties().vlan(); + } + + /** + * Set the vlan property: Vlan to use for the subnet. + * + * @param vlan the vlan value to set. + * @return the Subnet object itself. + */ + public Subnet withVlan(Integer vlan) { + if (this.innerProperties() == null) { + this.innerProperties = new SubnetProperties(); + } + this.innerProperties().withVlan(vlan); + 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); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Subnet from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Subnet 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 Subnet. + */ + public static Subnet fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Subnet deserializedSubnet = new Subnet(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedSubnet.innerProperties = SubnetProperties.fromJson(reader); + } else if ("name".equals(fieldName)) { + deserializedSubnet.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubnet; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SubnetIpConfigurationReference.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SubnetIpConfigurationReference.java new file mode 100644 index 000000000000..cfd5363f448d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/SubnetIpConfigurationReference.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The ARM ID for a Network Interface. + */ +@Fluent +public final class SubnetIpConfigurationReference implements JsonSerializable { + /* + * The ARM ID for a Network Interface. + */ + private String id; + + /** + * Creates an instance of SubnetIpConfigurationReference class. + */ + public SubnetIpConfigurationReference() { + } + + /** + * Get the id property: The ARM ID for a Network Interface. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM ID for a Network Interface. + * + * @param id the id value to set. + * @return the SubnetIpConfigurationReference object itself. + */ + public SubnetIpConfigurationReference withId(String id) { + this.id = id; + 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("ID", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SubnetIpConfigurationReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SubnetIpConfigurationReference 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 SubnetIpConfigurationReference. + */ + public static SubnetIpConfigurationReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SubnetIpConfigurationReference deserializedSubnetIpConfigurationReference + = new SubnetIpConfigurationReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("ID".equals(fieldName)) { + deserializedSubnetIpConfigurationReference.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSubnetIpConfigurationReference; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/UserAssignedIdentity.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..c42cdda39cfa --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/UserAssignedIdentity.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private String principalId; + + /* + * The client ID of the assigned identity. + */ + private String clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * 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.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VMDiskSecurityProfile.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VMDiskSecurityProfile.java new file mode 100644 index 000000000000..8be51a771774 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VMDiskSecurityProfile.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Specifies the security profile settings for the managed disk. NOTE: It can only be set for Confidential VMs. + */ +@Fluent +public final class VMDiskSecurityProfile implements JsonSerializable { + /* + * Specifies the EncryptionType of the managed disk. It is set to NonPersistedTPM for not persisting firmware state + * in the VMGuestState blob. NOTE: It can be set for only Confidential VMs. + */ + private SecurityEncryptionType securityEncryptionType; + + /** + * Creates an instance of VMDiskSecurityProfile class. + */ + public VMDiskSecurityProfile() { + } + + /** + * Get the securityEncryptionType property: Specifies the EncryptionType of the managed disk. It is set to + * NonPersistedTPM for not persisting firmware state in the VMGuestState blob. NOTE: It can be set for only + * Confidential VMs. + * + * @return the securityEncryptionType value. + */ + public SecurityEncryptionType securityEncryptionType() { + return this.securityEncryptionType; + } + + /** + * Set the securityEncryptionType property: Specifies the EncryptionType of the managed disk. It is set to + * NonPersistedTPM for not persisting firmware state in the VMGuestState blob. NOTE: It can be set for only + * Confidential VMs. + * + * @param securityEncryptionType the securityEncryptionType value to set. + * @return the VMDiskSecurityProfile object itself. + */ + public VMDiskSecurityProfile withSecurityEncryptionType(SecurityEncryptionType securityEncryptionType) { + this.securityEncryptionType = securityEncryptionType; + 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("securityEncryptionType", + this.securityEncryptionType == null ? null : this.securityEncryptionType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VMDiskSecurityProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VMDiskSecurityProfile 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 VMDiskSecurityProfile. + */ + public static VMDiskSecurityProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VMDiskSecurityProfile deserializedVMDiskSecurityProfile = new VMDiskSecurityProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("securityEncryptionType".equals(fieldName)) { + deserializedVMDiskSecurityProfile.securityEncryptionType + = SecurityEncryptionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVMDiskSecurityProfile; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisk.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisk.java new file mode 100644 index 000000000000..31ab4e4f2007 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisk.java @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskInner; +import java.util.Map; + +/** + * An immutable client-side representation of VirtualHardDisk. + */ +public interface VirtualHardDisk { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + VirtualHardDiskProperties properties(); + + /** + * Gets the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskInner object. + * + * @return the inner object. + */ + VirtualHardDiskInner innerModel(); + + /** + * The entirety of the VirtualHardDisk definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The VirtualHardDisk definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the VirtualHardDisk definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the VirtualHardDisk 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 VirtualHardDisk 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 VirtualHardDisk definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithExtendedLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualHardDisk create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualHardDisk create(Context context); + } + + /** + * The stage of the VirtualHardDisk 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 VirtualHardDisk definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(VirtualHardDiskProperties properties); + } + + /** + * The stage of the VirtualHardDisk definition allowing to specify extendedLocation. + */ + interface WithExtendedLocation { + /** + * Specifies the extendedLocation property: The extendedLocation of the resource.. + * + * @param extendedLocation The extendedLocation of the resource. + * @return the next definition stage. + */ + WithCreate withExtendedLocation(ExtendedLocation extendedLocation); + } + } + + /** + * Begins update for the VirtualHardDisk resource. + * + * @return the stage of resource update. + */ + VirtualHardDisk.Update update(); + + /** + * The template for VirtualHardDisk update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualHardDisk apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualHardDisk apply(Context context); + } + + /** + * The VirtualHardDisk update stages. + */ + interface UpdateStages { + /** + * The stage of the VirtualHardDisk 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 VirtualHardDisk update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Defines the resource properties for the update.. + * + * @param properties Defines the resource properties for the update. + * @return the next definition stage. + */ + Update withProperties(VirtualHardDisksUpdateProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualHardDisk refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualHardDisk refresh(Context context); + + /** + * The operation to upload a virtual hard disk. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + VirtualHardDiskUploadResponse upload(VirtualHardDiskUploadRequest body); + + /** + * The operation to upload a virtual hard disk. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + VirtualHardDiskUploadResponse upload(VirtualHardDiskUploadRequest body, Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskArmReference.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskArmReference.java new file mode 100644 index 000000000000..d68782489735 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskArmReference.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The ARM ID for a Virtual Hard Disk. + */ +@Fluent +public final class VirtualHardDiskArmReference implements JsonSerializable { + /* + * The ARM ID for a Virtual Hard Disk. + */ + private String id; + + /** + * Creates an instance of VirtualHardDiskArmReference class. + */ + public VirtualHardDiskArmReference() { + } + + /** + * Get the id property: The ARM ID for a Virtual Hard Disk. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM ID for a Virtual Hard Disk. + * + * @param id the id value to set. + * @return the VirtualHardDiskArmReference object itself. + */ + public VirtualHardDiskArmReference withId(String id) { + this.id = id; + 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("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDiskArmReference from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDiskArmReference 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 VirtualHardDiskArmReference. + */ + public static VirtualHardDiskArmReference fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDiskArmReference deserializedVirtualHardDiskArmReference = new VirtualHardDiskArmReference(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedVirtualHardDiskArmReference.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDiskArmReference; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskDownloadStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskDownloadStatus.java new file mode 100644 index 000000000000..4e00f4a6aafe --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskDownloadStatus.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The download status of the virtual hard disk. + */ +@Immutable +public final class VirtualHardDiskDownloadStatus implements JsonSerializable { + /* + * The downloaded sized of the virtual hard disk in MB + */ + private Long downloadedSizeInMB; + + /* + * The status of Uploading virtual hard disk [Succeeded, Failed, InProgress] + */ + private Status status; + + /* + * The progress of the operation in percentage + */ + private Long progressPercentage; + + /** + * Creates an instance of VirtualHardDiskDownloadStatus class. + */ + private VirtualHardDiskDownloadStatus() { + } + + /** + * Get the downloadedSizeInMB property: The downloaded sized of the virtual hard disk in MB. + * + * @return the downloadedSizeInMB value. + */ + public Long downloadedSizeInMB() { + return this.downloadedSizeInMB; + } + + /** + * Get the status property: The status of Uploading virtual hard disk [Succeeded, Failed, InProgress]. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Get the progressPercentage property: The progress of the operation in percentage. + * + * @return the progressPercentage value. + */ + public Long progressPercentage() { + return this.progressPercentage; + } + + /** + * 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("downloadedSizeInMB", this.downloadedSizeInMB); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeNumberField("progressPercentage", this.progressPercentage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDiskDownloadStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDiskDownloadStatus 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 VirtualHardDiskDownloadStatus. + */ + public static VirtualHardDiskDownloadStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDiskDownloadStatus deserializedVirtualHardDiskDownloadStatus + = new VirtualHardDiskDownloadStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("downloadedSizeInMB".equals(fieldName)) { + deserializedVirtualHardDiskDownloadStatus.downloadedSizeInMB + = reader.getNullable(JsonReader::getLong); + } else if ("status".equals(fieldName)) { + deserializedVirtualHardDiskDownloadStatus.status = Status.fromString(reader.getString()); + } else if ("progressPercentage".equals(fieldName)) { + deserializedVirtualHardDiskDownloadStatus.progressPercentage + = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDiskDownloadStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskProperties.java new file mode 100644 index 000000000000..66866a223c0f --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskProperties.java @@ -0,0 +1,421 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Properties under the virtual hard disk resource. + */ +@Fluent +public final class VirtualHardDiskProperties implements JsonSerializable { + /* + * Block size in bytes + */ + private Integer blockSizeBytes; + + /* + * Size of the disk in GB + */ + private Long diskSizeGB; + + /* + * Boolean for enabling dynamic sizing on the virtual hard disk + */ + private Boolean dynamic; + + /* + * Logical sector in bytes + */ + private Integer logicalSectorBytes; + + /* + * Physical sector in bytes + */ + private Integer physicalSectorBytes; + + /* + * URL for downloading or accessing the virtual hard disk. This URL points to a secure link from where the VHD can + * be downloaded or accessed directly. + */ + private String downloadUrl; + + /* + * The hypervisor generation of the Virtual Machine [V1, V2] + */ + private HyperVGeneration hyperVGeneration; + + /* + * The format of the actual VHD file [vhd, vhdx] + */ + private DiskFileFormat diskFileFormat; + + /* + * Boolean indicating whether it is an existing local hard disk or if one should be created. + */ + private Boolean createFromLocal; + + /* + * Provisioning state of the virtual hard disk. + */ + private ProvisioningStateEnum provisioningState; + + /* + * Storage ContainerID of the storage container to be used for VHD + */ + private String containerId; + + /* + * The observed state of virtual hard disks + */ + private VirtualHardDiskStatus status; + + /* + * The maximum number of VMs that can attach to the disk at the same time. Value greater than one indicates a disk + * that can be mounted on multiple VMs at the same time. + */ + private Long maxShares; + + /** + * Creates an instance of VirtualHardDiskProperties class. + */ + public VirtualHardDiskProperties() { + } + + /** + * Get the blockSizeBytes property: Block size in bytes. + * + * @return the blockSizeBytes value. + */ + public Integer blockSizeBytes() { + return this.blockSizeBytes; + } + + /** + * Set the blockSizeBytes property: Block size in bytes. + * + * @param blockSizeBytes the blockSizeBytes value to set. + * @return the VirtualHardDiskProperties object itself. + */ + public VirtualHardDiskProperties withBlockSizeBytes(Integer blockSizeBytes) { + this.blockSizeBytes = blockSizeBytes; + return this; + } + + /** + * Get the diskSizeGB property: Size of the disk in GB. + * + * @return the diskSizeGB value. + */ + public Long diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Size of the disk in GB. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the VirtualHardDiskProperties object itself. + */ + public VirtualHardDiskProperties withDiskSizeGB(Long diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the dynamic property: Boolean for enabling dynamic sizing on the virtual hard disk. + * + * @return the dynamic value. + */ + public Boolean dynamic() { + return this.dynamic; + } + + /** + * Set the dynamic property: Boolean for enabling dynamic sizing on the virtual hard disk. + * + * @param dynamic the dynamic value to set. + * @return the VirtualHardDiskProperties object itself. + */ + public VirtualHardDiskProperties withDynamic(Boolean dynamic) { + this.dynamic = dynamic; + return this; + } + + /** + * Get the logicalSectorBytes property: Logical sector in bytes. + * + * @return the logicalSectorBytes value. + */ + public Integer logicalSectorBytes() { + return this.logicalSectorBytes; + } + + /** + * Set the logicalSectorBytes property: Logical sector in bytes. + * + * @param logicalSectorBytes the logicalSectorBytes value to set. + * @return the VirtualHardDiskProperties object itself. + */ + public VirtualHardDiskProperties withLogicalSectorBytes(Integer logicalSectorBytes) { + this.logicalSectorBytes = logicalSectorBytes; + return this; + } + + /** + * Get the physicalSectorBytes property: Physical sector in bytes. + * + * @return the physicalSectorBytes value. + */ + public Integer physicalSectorBytes() { + return this.physicalSectorBytes; + } + + /** + * Set the physicalSectorBytes property: Physical sector in bytes. + * + * @param physicalSectorBytes the physicalSectorBytes value to set. + * @return the VirtualHardDiskProperties object itself. + */ + public VirtualHardDiskProperties withPhysicalSectorBytes(Integer physicalSectorBytes) { + this.physicalSectorBytes = physicalSectorBytes; + return this; + } + + /** + * Get the downloadUrl property: URL for downloading or accessing the virtual hard disk. This URL points to a secure + * link from where the VHD can be downloaded or accessed directly. + * + * @return the downloadUrl value. + */ + public String downloadUrl() { + return this.downloadUrl; + } + + /** + * Set the downloadUrl property: URL for downloading or accessing the virtual hard disk. This URL points to a secure + * link from where the VHD can be downloaded or accessed directly. + * + * @param downloadUrl the downloadUrl value to set. + * @return the VirtualHardDiskProperties object itself. + */ + public VirtualHardDiskProperties withDownloadUrl(String downloadUrl) { + this.downloadUrl = downloadUrl; + return this; + } + + /** + * Get the hyperVGeneration property: The hypervisor generation of the Virtual Machine [V1, V2]. + * + * @return the hyperVGeneration value. + */ + public HyperVGeneration hyperVGeneration() { + return this.hyperVGeneration; + } + + /** + * Set the hyperVGeneration property: The hypervisor generation of the Virtual Machine [V1, V2]. + * + * @param hyperVGeneration the hyperVGeneration value to set. + * @return the VirtualHardDiskProperties object itself. + */ + public VirtualHardDiskProperties withHyperVGeneration(HyperVGeneration hyperVGeneration) { + this.hyperVGeneration = hyperVGeneration; + return this; + } + + /** + * Get the diskFileFormat property: The format of the actual VHD file [vhd, vhdx]. + * + * @return the diskFileFormat value. + */ + public DiskFileFormat diskFileFormat() { + return this.diskFileFormat; + } + + /** + * Set the diskFileFormat property: The format of the actual VHD file [vhd, vhdx]. + * + * @param diskFileFormat the diskFileFormat value to set. + * @return the VirtualHardDiskProperties object itself. + */ + public VirtualHardDiskProperties withDiskFileFormat(DiskFileFormat diskFileFormat) { + this.diskFileFormat = diskFileFormat; + return this; + } + + /** + * Get the createFromLocal property: Boolean indicating whether it is an existing local hard disk or if one should + * be created. + * + * @return the createFromLocal value. + */ + public Boolean createFromLocal() { + return this.createFromLocal; + } + + /** + * Set the createFromLocal property: Boolean indicating whether it is an existing local hard disk or if one should + * be created. + * + * @param createFromLocal the createFromLocal value to set. + * @return the VirtualHardDiskProperties object itself. + */ + public VirtualHardDiskProperties withCreateFromLocal(Boolean createFromLocal) { + this.createFromLocal = createFromLocal; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the virtual hard disk. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Get the containerId property: Storage ContainerID of the storage container to be used for VHD. + * + * @return the containerId value. + */ + public String containerId() { + return this.containerId; + } + + /** + * Set the containerId property: Storage ContainerID of the storage container to be used for VHD. + * + * @param containerId the containerId value to set. + * @return the VirtualHardDiskProperties object itself. + */ + public VirtualHardDiskProperties withContainerId(String containerId) { + this.containerId = containerId; + return this; + } + + /** + * Get the status property: The observed state of virtual hard disks. + * + * @return the status value. + */ + public VirtualHardDiskStatus status() { + return this.status; + } + + /** + * Get the maxShares property: The maximum number of VMs that can attach to the disk at the same time. Value greater + * than one indicates a disk that can be mounted on multiple VMs at the same time. + * + * @return the maxShares value. + */ + public Long maxShares() { + return this.maxShares; + } + + /** + * Set the maxShares property: The maximum number of VMs that can attach to the disk at the same time. Value greater + * than one indicates a disk that can be mounted on multiple VMs at the same time. + * + * @param maxShares the maxShares value to set. + * @return the VirtualHardDiskProperties object itself. + */ + public VirtualHardDiskProperties withMaxShares(Long maxShares) { + this.maxShares = maxShares; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() != null) { + status().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("blockSizeBytes", this.blockSizeBytes); + jsonWriter.writeNumberField("diskSizeGB", this.diskSizeGB); + jsonWriter.writeBooleanField("dynamic", this.dynamic); + jsonWriter.writeNumberField("logicalSectorBytes", this.logicalSectorBytes); + jsonWriter.writeNumberField("physicalSectorBytes", this.physicalSectorBytes); + jsonWriter.writeStringField("downloadUrl", this.downloadUrl); + jsonWriter.writeStringField("hyperVGeneration", + this.hyperVGeneration == null ? null : this.hyperVGeneration.toString()); + jsonWriter.writeStringField("diskFileFormat", + this.diskFileFormat == null ? null : this.diskFileFormat.toString()); + jsonWriter.writeBooleanField("createFromLocal", this.createFromLocal); + jsonWriter.writeStringField("containerId", this.containerId); + jsonWriter.writeNumberField("maxShares", this.maxShares); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDiskProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDiskProperties 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 VirtualHardDiskProperties. + */ + public static VirtualHardDiskProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDiskProperties deserializedVirtualHardDiskProperties = new VirtualHardDiskProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("blockSizeBytes".equals(fieldName)) { + deserializedVirtualHardDiskProperties.blockSizeBytes = reader.getNullable(JsonReader::getInt); + } else if ("diskSizeGB".equals(fieldName)) { + deserializedVirtualHardDiskProperties.diskSizeGB = reader.getNullable(JsonReader::getLong); + } else if ("dynamic".equals(fieldName)) { + deserializedVirtualHardDiskProperties.dynamic = reader.getNullable(JsonReader::getBoolean); + } else if ("logicalSectorBytes".equals(fieldName)) { + deserializedVirtualHardDiskProperties.logicalSectorBytes = reader.getNullable(JsonReader::getInt); + } else if ("physicalSectorBytes".equals(fieldName)) { + deserializedVirtualHardDiskProperties.physicalSectorBytes = reader.getNullable(JsonReader::getInt); + } else if ("downloadUrl".equals(fieldName)) { + deserializedVirtualHardDiskProperties.downloadUrl = reader.getString(); + } else if ("hyperVGeneration".equals(fieldName)) { + deserializedVirtualHardDiskProperties.hyperVGeneration + = HyperVGeneration.fromString(reader.getString()); + } else if ("diskFileFormat".equals(fieldName)) { + deserializedVirtualHardDiskProperties.diskFileFormat + = DiskFileFormat.fromString(reader.getString()); + } else if ("createFromLocal".equals(fieldName)) { + deserializedVirtualHardDiskProperties.createFromLocal = reader.getNullable(JsonReader::getBoolean); + } else if ("provisioningState".equals(fieldName)) { + deserializedVirtualHardDiskProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else if ("containerId".equals(fieldName)) { + deserializedVirtualHardDiskProperties.containerId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedVirtualHardDiskProperties.status = VirtualHardDiskStatus.fromJson(reader); + } else if ("maxShares".equals(fieldName)) { + deserializedVirtualHardDiskProperties.maxShares = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDiskProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskStatus.java new file mode 100644 index 000000000000..f3dae228ee4e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskStatus.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The observed state of virtual hard disks. + */ +@Immutable +public final class VirtualHardDiskStatus implements JsonSerializable { + /* + * VirtualHardDisk provisioning error code + */ + private String errorCode; + + /* + * Descriptive error message + */ + private String errorMessage; + + /* + * Provisioning status of the vhd + */ + private VirtualHardDiskStatusProvisioningStatus provisioningStatus; + + /* + * The download status of the virtual hard disk + */ + private VirtualHardDiskDownloadStatus downloadStatus; + + /* + * The upload status of the virtual hard disk + */ + private VirtualHardDiskUploadStatus uploadStatus; + + /* + * ARM IDs of the VMs that are consuming the VHD. + */ + private List managedBy; + + /* + * Unique Guid identifying the resource. + */ + private String uniqueId; + + /** + * Creates an instance of VirtualHardDiskStatus class. + */ + private VirtualHardDiskStatus() { + } + + /** + * Get the errorCode property: VirtualHardDisk provisioning error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: Descriptive error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the provisioningStatus property: Provisioning status of the vhd. + * + * @return the provisioningStatus value. + */ + public VirtualHardDiskStatusProvisioningStatus provisioningStatus() { + return this.provisioningStatus; + } + + /** + * Get the downloadStatus property: The download status of the virtual hard disk. + * + * @return the downloadStatus value. + */ + public VirtualHardDiskDownloadStatus downloadStatus() { + return this.downloadStatus; + } + + /** + * Get the uploadStatus property: The upload status of the virtual hard disk. + * + * @return the uploadStatus value. + */ + public VirtualHardDiskUploadStatus uploadStatus() { + return this.uploadStatus; + } + + /** + * Get the managedBy property: ARM IDs of the VMs that are consuming the VHD. + * + * @return the managedBy value. + */ + public List managedBy() { + return this.managedBy; + } + + /** + * Get the uniqueId property: Unique Guid identifying the resource. + * + * @return the uniqueId value. + */ + public String uniqueId() { + return this.uniqueId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provisioningStatus() != null) { + provisioningStatus().validate(); + } + if (downloadStatus() != null) { + downloadStatus().validate(); + } + if (uploadStatus() != null) { + uploadStatus().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeJsonField("provisioningStatus", this.provisioningStatus); + jsonWriter.writeJsonField("downloadStatus", this.downloadStatus); + jsonWriter.writeJsonField("uploadStatus", this.uploadStatus); + jsonWriter.writeArrayField("managedBy", this.managedBy, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("uniqueId", this.uniqueId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDiskStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDiskStatus 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 VirtualHardDiskStatus. + */ + public static VirtualHardDiskStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDiskStatus deserializedVirtualHardDiskStatus = new VirtualHardDiskStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedVirtualHardDiskStatus.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedVirtualHardDiskStatus.errorMessage = reader.getString(); + } else if ("provisioningStatus".equals(fieldName)) { + deserializedVirtualHardDiskStatus.provisioningStatus + = VirtualHardDiskStatusProvisioningStatus.fromJson(reader); + } else if ("downloadStatus".equals(fieldName)) { + deserializedVirtualHardDiskStatus.downloadStatus = VirtualHardDiskDownloadStatus.fromJson(reader); + } else if ("uploadStatus".equals(fieldName)) { + deserializedVirtualHardDiskStatus.uploadStatus = VirtualHardDiskUploadStatus.fromJson(reader); + } else if ("managedBy".equals(fieldName)) { + List managedBy = reader.readArray(reader1 -> reader1.getString()); + deserializedVirtualHardDiskStatus.managedBy = managedBy; + } else if ("uniqueId".equals(fieldName)) { + deserializedVirtualHardDiskStatus.uniqueId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDiskStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskStatusProvisioningStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskStatusProvisioningStatus.java new file mode 100644 index 000000000000..54e48e8bf999 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskStatusProvisioningStatus.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * VHD Status provisioning status. + */ +@Immutable +public final class VirtualHardDiskStatusProvisioningStatus + implements JsonSerializable { + /* + * The ID of the operation performed on the virtual hard disk + */ + private String operationId; + + /* + * The status of the operation performed on the virtual hard disk [Succeeded, Failed, InProgress] + */ + private Status status; + + /** + * Creates an instance of VirtualHardDiskStatusProvisioningStatus class. + */ + private VirtualHardDiskStatusProvisioningStatus() { + } + + /** + * Get the operationId property: The ID of the operation performed on the virtual hard disk. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the status property: The status of the operation performed on the virtual hard disk [Succeeded, Failed, + * InProgress]. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * 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("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDiskStatusProvisioningStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDiskStatusProvisioningStatus 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 VirtualHardDiskStatusProvisioningStatus. + */ + public static VirtualHardDiskStatusProvisioningStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDiskStatusProvisioningStatus deserializedVirtualHardDiskStatusProvisioningStatus + = new VirtualHardDiskStatusProvisioningStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + deserializedVirtualHardDiskStatusProvisioningStatus.operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedVirtualHardDiskStatusProvisioningStatus.status = Status.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDiskStatusProvisioningStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskUploadRequest.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskUploadRequest.java new file mode 100644 index 000000000000..1a801dcd2899 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskUploadRequest.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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 for uploading virtual hard disk. + */ +@Fluent +public final class VirtualHardDiskUploadRequest implements JsonSerializable { + /* + * The Azure managed disk SAS URL to upload the virtual hard disk to. + */ + private String azureManagedDiskUploadUrl; + + /** + * Creates an instance of VirtualHardDiskUploadRequest class. + */ + public VirtualHardDiskUploadRequest() { + } + + /** + * Get the azureManagedDiskUploadUrl property: The Azure managed disk SAS URL to upload the virtual hard disk to. + * + * @return the azureManagedDiskUploadUrl value. + */ + public String azureManagedDiskUploadUrl() { + return this.azureManagedDiskUploadUrl; + } + + /** + * Set the azureManagedDiskUploadUrl property: The Azure managed disk SAS URL to upload the virtual hard disk to. + * + * @param azureManagedDiskUploadUrl the azureManagedDiskUploadUrl value to set. + * @return the VirtualHardDiskUploadRequest object itself. + */ + public VirtualHardDiskUploadRequest withAzureManagedDiskUploadUrl(String azureManagedDiskUploadUrl) { + this.azureManagedDiskUploadUrl = azureManagedDiskUploadUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (azureManagedDiskUploadUrl() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property azureManagedDiskUploadUrl in model VirtualHardDiskUploadRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualHardDiskUploadRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("azureManagedDiskUploadUrl", this.azureManagedDiskUploadUrl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDiskUploadRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDiskUploadRequest 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 VirtualHardDiskUploadRequest. + */ + public static VirtualHardDiskUploadRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDiskUploadRequest deserializedVirtualHardDiskUploadRequest = new VirtualHardDiskUploadRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("azureManagedDiskUploadUrl".equals(fieldName)) { + deserializedVirtualHardDiskUploadRequest.azureManagedDiskUploadUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDiskUploadRequest; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskUploadResponse.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskUploadResponse.java new file mode 100644 index 000000000000..d313473f6b84 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskUploadResponse.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskUploadResponseInner; + +/** + * An immutable client-side representation of VirtualHardDiskUploadResponse. + */ +public interface VirtualHardDiskUploadResponse { + /** + * Gets the virtualHardDiskId property: The ARM ID for a Virtual Hard Disk. + * + * @return the virtualHardDiskId value. + */ + String virtualHardDiskId(); + + /** + * Gets the uploadStatus property: The upload status of the virtual hard disk. + * + * @return the uploadStatus value. + */ + VirtualHardDiskUploadStatus uploadStatus(); + + /** + * Gets the inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskUploadResponseInner + * object. + * + * @return the inner object. + */ + VirtualHardDiskUploadResponseInner innerModel(); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskUploadStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskUploadStatus.java new file mode 100644 index 000000000000..726b7c8e0a83 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDiskUploadStatus.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The upload status of the virtual hard disk. + */ +@Immutable +public final class VirtualHardDiskUploadStatus implements JsonSerializable { + /* + * The uploaded sized of the virtual hard disk in MB + */ + private Long uploadedSizeInMB; + + /* + * The status of Uploading virtual hard disk [Succeeded, Failed, InProgress] + */ + private Status status; + + /* + * The progress of the operation in percentage + */ + private Long progressPercentage; + + /* + * VirtualHardDisk upload error code + */ + private String errorCode; + + /* + * Descriptive upload error message + */ + private String errorMessage; + + /** + * Creates an instance of VirtualHardDiskUploadStatus class. + */ + private VirtualHardDiskUploadStatus() { + } + + /** + * Get the uploadedSizeInMB property: The uploaded sized of the virtual hard disk in MB. + * + * @return the uploadedSizeInMB value. + */ + public Long uploadedSizeInMB() { + return this.uploadedSizeInMB; + } + + /** + * Get the status property: The status of Uploading virtual hard disk [Succeeded, Failed, InProgress]. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Get the progressPercentage property: The progress of the operation in percentage. + * + * @return the progressPercentage value. + */ + public Long progressPercentage() { + return this.progressPercentage; + } + + /** + * Get the errorCode property: VirtualHardDisk upload error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: Descriptive upload error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * 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("uploadedSizeInMB", this.uploadedSizeInMB); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeNumberField("progressPercentage", this.progressPercentage); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDiskUploadStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDiskUploadStatus 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 VirtualHardDiskUploadStatus. + */ + public static VirtualHardDiskUploadStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDiskUploadStatus deserializedVirtualHardDiskUploadStatus = new VirtualHardDiskUploadStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uploadedSizeInMB".equals(fieldName)) { + deserializedVirtualHardDiskUploadStatus.uploadedSizeInMB = reader.getNullable(JsonReader::getLong); + } else if ("status".equals(fieldName)) { + deserializedVirtualHardDiskUploadStatus.status = Status.fromString(reader.getString()); + } else if ("progressPercentage".equals(fieldName)) { + deserializedVirtualHardDiskUploadStatus.progressPercentage + = reader.getNullable(JsonReader::getLong); + } else if ("errorCode".equals(fieldName)) { + deserializedVirtualHardDiskUploadStatus.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedVirtualHardDiskUploadStatus.errorMessage = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDiskUploadStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisks.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisks.java new file mode 100644 index 000000000000..1f3192ad0fa3 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisks.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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 VirtualHardDisks. + */ +public interface VirtualHardDisks { + /** + * Gets a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 virtual hard disk along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String virtualHardDiskName, + Context context); + + /** + * Gets a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 virtual hard disk. + */ + VirtualHardDisk getByResourceGroup(String resourceGroupName, String virtualHardDiskName); + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualHardDiskName); + + /** + * The operation to delete a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 virtualHardDiskName, Context context); + + /** + * Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @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 VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all of the virtual hard disks in the specified resource group. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @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 VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all of the virtual hard disks in the specified subscription. Use the nextLink property in the response to + * get the next page of virtual hard disks. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a VirtualHardDisk list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + VirtualHardDiskUploadResponse upload(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskUploadRequest body); + + /** + * The operation to upload a virtual hard disk. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param virtualHardDiskName Name of the virtual hard disk. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + VirtualHardDiskUploadResponse upload(String resourceGroupName, String virtualHardDiskName, + VirtualHardDiskUploadRequest body, Context context); + + /** + * Gets a virtual hard disk. + * + * @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 virtual hard disk along with {@link Response}. + */ + VirtualHardDisk getById(String id); + + /** + * Gets a virtual hard disk. + * + * @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 virtual hard disk along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The operation to delete a virtual hard disk. + * + * @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); + + /** + * The operation to delete a virtual hard disk. + * + * @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 VirtualHardDisk resource. + * + * @param name resource name. + * @return the first stage of the new VirtualHardDisk definition. + */ + VirtualHardDisk.DefinitionStages.Blank define(String name); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisksUpdateProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisksUpdateProperties.java new file mode 100644 index 000000000000..90ea17512163 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisksUpdateProperties.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Defines the resource properties for the update. + */ +@Fluent +public final class VirtualHardDisksUpdateProperties implements JsonSerializable { + /* + * Size of the disk in GB + */ + private Long diskSizeGB; + + /** + * Creates an instance of VirtualHardDisksUpdateProperties class. + */ + public VirtualHardDisksUpdateProperties() { + } + + /** + * Get the diskSizeGB property: Size of the disk in GB. + * + * @return the diskSizeGB value. + */ + public Long diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Size of the disk in GB. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the VirtualHardDisksUpdateProperties object itself. + */ + public VirtualHardDisksUpdateProperties withDiskSizeGB(Long diskSizeGB) { + this.diskSizeGB = diskSizeGB; + 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("diskSizeGB", this.diskSizeGB); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDisksUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDisksUpdateProperties 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 VirtualHardDisksUpdateProperties. + */ + public static VirtualHardDisksUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDisksUpdateProperties deserializedVirtualHardDisksUpdateProperties + = new VirtualHardDisksUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("diskSizeGB".equals(fieldName)) { + deserializedVirtualHardDisksUpdateProperties.diskSizeGB = reader.getNullable(JsonReader::getLong); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDisksUpdateProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisksUpdateRequest.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisksUpdateRequest.java new file mode 100644 index 000000000000..e6d741b78e31 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualHardDisksUpdateRequest.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The virtual hard disk resource patch definition. + */ +@Fluent +public final class VirtualHardDisksUpdateRequest implements JsonSerializable { + /* + * Resource tags + */ + private Map tags; + + /* + * Defines the resource properties for the update. + */ + private VirtualHardDisksUpdateProperties properties; + + /** + * Creates an instance of VirtualHardDisksUpdateRequest class. + */ + public VirtualHardDisksUpdateRequest() { + } + + /** + * 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 VirtualHardDisksUpdateRequest object itself. + */ + public VirtualHardDisksUpdateRequest withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: Defines the resource properties for the update. + * + * @return the properties value. + */ + public VirtualHardDisksUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Defines the resource properties for the update. + * + * @param properties the properties value to set. + * @return the VirtualHardDisksUpdateRequest object itself. + */ + public VirtualHardDisksUpdateRequest withProperties(VirtualHardDisksUpdateProperties 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.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualHardDisksUpdateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualHardDisksUpdateRequest 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 VirtualHardDisksUpdateRequest. + */ + public static VirtualHardDisksUpdateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualHardDisksUpdateRequest deserializedVirtualHardDisksUpdateRequest + = new VirtualHardDisksUpdateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedVirtualHardDisksUpdateRequest.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedVirtualHardDisksUpdateRequest.properties + = VirtualHardDisksUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualHardDisksUpdateRequest; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineConfigAgentInstanceView.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineConfigAgentInstanceView.java new file mode 100644 index 000000000000..4964be21ce48 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineConfigAgentInstanceView.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The instance view of the VM Config Agent running on the virtual machine. + */ +@Immutable +public final class VirtualMachineConfigAgentInstanceView + implements JsonSerializable { + /* + * The VM Config Agent full version. + */ + private String vmConfigAgentVersion; + + /* + * The resource status information. + */ + private List statuses; + + /** + * Creates an instance of VirtualMachineConfigAgentInstanceView class. + */ + private VirtualMachineConfigAgentInstanceView() { + } + + /** + * Get the vmConfigAgentVersion property: The VM Config Agent full version. + * + * @return the vmConfigAgentVersion value. + */ + public String vmConfigAgentVersion() { + return this.vmConfigAgentVersion; + } + + /** + * Get the statuses property: The resource status information. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("vmConfigAgentVersion", this.vmConfigAgentVersion); + jsonWriter.writeArrayField("statuses", this.statuses, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineConfigAgentInstanceView from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineConfigAgentInstanceView 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 VirtualMachineConfigAgentInstanceView. + */ + public static VirtualMachineConfigAgentInstanceView fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineConfigAgentInstanceView deserializedVirtualMachineConfigAgentInstanceView + = new VirtualMachineConfigAgentInstanceView(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vmConfigAgentVersion".equals(fieldName)) { + deserializedVirtualMachineConfigAgentInstanceView.vmConfigAgentVersion = reader.getString(); + } else if ("statuses".equals(fieldName)) { + List statuses + = reader.readArray(reader1 -> InstanceViewStatus.fromJson(reader1)); + deserializedVirtualMachineConfigAgentInstanceView.statuses = statuses; + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineConfigAgentInstanceView; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstance.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstance.java new file mode 100644 index 000000000000..eae20c492d07 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstance.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner; + +/** + * An immutable client-side representation of VirtualMachineInstance. + */ +public interface VirtualMachineInstance { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + VirtualMachineInstanceProperties properties(); + + /** + * Gets the extendedLocation property: The extendedLocation of the resource. + * + * @return the extendedLocation value. + */ + ExtendedLocation extendedLocation(); + + /** + * 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 inner com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner object. + * + * @return the inner object. + */ + VirtualMachineInstanceInner innerModel(); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceManagedDiskParameters.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceManagedDiskParameters.java new file mode 100644 index 000000000000..db1f9848b435 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceManagedDiskParameters.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The parameters of a managed disk. + */ +@Fluent +public final class VirtualMachineInstanceManagedDiskParameters + implements JsonSerializable { + /* + * Specifies the security profile for the managed disk. + */ + private VMDiskSecurityProfile securityProfile; + + /** + * Creates an instance of VirtualMachineInstanceManagedDiskParameters class. + */ + public VirtualMachineInstanceManagedDiskParameters() { + } + + /** + * Get the securityProfile property: Specifies the security profile for the managed disk. + * + * @return the securityProfile value. + */ + public VMDiskSecurityProfile securityProfile() { + return this.securityProfile; + } + + /** + * Set the securityProfile property: Specifies the security profile for the managed disk. + * + * @param securityProfile the securityProfile value to set. + * @return the VirtualMachineInstanceManagedDiskParameters object itself. + */ + public VirtualMachineInstanceManagedDiskParameters withSecurityProfile(VMDiskSecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (securityProfile() != null) { + securityProfile().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("securityProfile", this.securityProfile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstanceManagedDiskParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstanceManagedDiskParameters 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 VirtualMachineInstanceManagedDiskParameters. + */ + public static VirtualMachineInstanceManagedDiskParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstanceManagedDiskParameters deserializedVirtualMachineInstanceManagedDiskParameters + = new VirtualMachineInstanceManagedDiskParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("securityProfile".equals(fieldName)) { + deserializedVirtualMachineInstanceManagedDiskParameters.securityProfile + = VMDiskSecurityProfile.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstanceManagedDiskParameters; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceProperties.java new file mode 100644 index 000000000000..b32780da13f9 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceProperties.java @@ -0,0 +1,517 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Properties under the virtual machine instance resource. + */ +@Fluent +public final class VirtualMachineInstanceProperties implements JsonSerializable { + /* + * HardwareProfile - Specifies the hardware settings for the virtual machine instance. + */ + private VirtualMachineInstancePropertiesHardwareProfile hardwareProfile; + + /* + * PlacementProfile - Specifies the placement related settings for the virtual machine. + */ + private VirtualMachineInstancePropertiesPlacementProfile placementProfile; + + /* + * NetworkProfile - describes the network configuration the virtual machine instance + */ + private VirtualMachineInstancePropertiesNetworkProfile networkProfile; + + /* + * OsProfile - describes the configuration of the operating system and sets login data + */ + private VirtualMachineInstancePropertiesOsProfile osProfile; + + /* + * SecurityProfile - Specifies the security settings for the virtual machine instance. + */ + private VirtualMachineInstancePropertiesSecurityProfile securityProfile; + + /* + * StorageProfile - contains information about the disks and storage information for the virtual machine instance + */ + private VirtualMachineInstancePropertiesStorageProfile storageProfile; + + /* + * HTTP Proxy configuration for the VM. + */ + private HttpProxyConfiguration httpProxyConfig; + + /* + * Boolean indicating whether this is an existing local virtual machine or if one should be created. + */ + private Boolean createFromLocal; + + /* + * Provisioning state of the virtual machine instance. + */ + private ProvisioningStateEnum provisioningState; + + /* + * The virtual machine instance view. + */ + private VirtualMachineInstanceView instanceView; + + /* + * The observed state of virtual machine instances + */ + private VirtualMachineInstanceStatus status; + + /* + * Guest agent install status. + */ + private GuestAgentInstallStatus guestAgentInstallStatus; + + /* + * Unique identifier for the vm resource. + */ + private String vmId; + + /* + * Unique identifier defined by ARC to identify the guest of the VM. + */ + private String resourceUid; + + /* + * Unique identifier for the Hyper-V VM resource. + */ + private String hyperVVmId; + + /* + * Name of the host node that the VM is on. + */ + private String hostNodeName; + + /* + * Name of the host node that the VM is on. + */ + private String hostNodeIpAddress; + + /** + * Creates an instance of VirtualMachineInstanceProperties class. + */ + public VirtualMachineInstanceProperties() { + } + + /** + * Get the hardwareProfile property: HardwareProfile - Specifies the hardware settings for the virtual machine + * instance. + * + * @return the hardwareProfile value. + */ + public VirtualMachineInstancePropertiesHardwareProfile hardwareProfile() { + return this.hardwareProfile; + } + + /** + * Set the hardwareProfile property: HardwareProfile - Specifies the hardware settings for the virtual machine + * instance. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachineInstanceProperties object itself. + */ + public VirtualMachineInstanceProperties + withHardwareProfile(VirtualMachineInstancePropertiesHardwareProfile hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Get the placementProfile property: PlacementProfile - Specifies the placement related settings for the virtual + * machine. + * + * @return the placementProfile value. + */ + public VirtualMachineInstancePropertiesPlacementProfile placementProfile() { + return this.placementProfile; + } + + /** + * Set the placementProfile property: PlacementProfile - Specifies the placement related settings for the virtual + * machine. + * + * @param placementProfile the placementProfile value to set. + * @return the VirtualMachineInstanceProperties object itself. + */ + public VirtualMachineInstanceProperties + withPlacementProfile(VirtualMachineInstancePropertiesPlacementProfile placementProfile) { + this.placementProfile = placementProfile; + return this; + } + + /** + * Get the networkProfile property: NetworkProfile - describes the network configuration the virtual machine + * instance. + * + * @return the networkProfile value. + */ + public VirtualMachineInstancePropertiesNetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: NetworkProfile - describes the network configuration the virtual machine + * instance. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineInstanceProperties object itself. + */ + public VirtualMachineInstanceProperties + withNetworkProfile(VirtualMachineInstancePropertiesNetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the osProfile property: OsProfile - describes the configuration of the operating system and sets login data. + * + * @return the osProfile value. + */ + public VirtualMachineInstancePropertiesOsProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: OsProfile - describes the configuration of the operating system and sets login data. + * + * @param osProfile the osProfile value to set. + * @return the VirtualMachineInstanceProperties object itself. + */ + public VirtualMachineInstanceProperties withOsProfile(VirtualMachineInstancePropertiesOsProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the securityProfile property: SecurityProfile - Specifies the security settings for the virtual machine + * instance. + * + * @return the securityProfile value. + */ + public VirtualMachineInstancePropertiesSecurityProfile securityProfile() { + return this.securityProfile; + } + + /** + * Set the securityProfile property: SecurityProfile - Specifies the security settings for the virtual machine + * instance. + * + * @param securityProfile the securityProfile value to set. + * @return the VirtualMachineInstanceProperties object itself. + */ + public VirtualMachineInstanceProperties + withSecurityProfile(VirtualMachineInstancePropertiesSecurityProfile securityProfile) { + this.securityProfile = securityProfile; + return this; + } + + /** + * Get the storageProfile property: StorageProfile - contains information about the disks and storage information + * for the virtual machine instance. + * + * @return the storageProfile value. + */ + public VirtualMachineInstancePropertiesStorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: StorageProfile - contains information about the disks and storage information + * for the virtual machine instance. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineInstanceProperties object itself. + */ + public VirtualMachineInstanceProperties + withStorageProfile(VirtualMachineInstancePropertiesStorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the httpProxyConfig property: HTTP Proxy configuration for the VM. + * + * @return the httpProxyConfig value. + */ + public HttpProxyConfiguration httpProxyConfig() { + return this.httpProxyConfig; + } + + /** + * Set the httpProxyConfig property: HTTP Proxy configuration for the VM. + * + * @param httpProxyConfig the httpProxyConfig value to set. + * @return the VirtualMachineInstanceProperties object itself. + */ + public VirtualMachineInstanceProperties withHttpProxyConfig(HttpProxyConfiguration httpProxyConfig) { + this.httpProxyConfig = httpProxyConfig; + return this; + } + + /** + * Get the createFromLocal property: Boolean indicating whether this is an existing local virtual machine or if one + * should be created. + * + * @return the createFromLocal value. + */ + public Boolean createFromLocal() { + return this.createFromLocal; + } + + /** + * Set the createFromLocal property: Boolean indicating whether this is an existing local virtual machine or if one + * should be created. + * + * @param createFromLocal the createFromLocal value to set. + * @return the VirtualMachineInstanceProperties object itself. + */ + public VirtualMachineInstanceProperties withCreateFromLocal(Boolean createFromLocal) { + this.createFromLocal = createFromLocal; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the virtual machine instance. + * + * @return the provisioningState value. + */ + public ProvisioningStateEnum provisioningState() { + return this.provisioningState; + } + + /** + * Get the instanceView property: The virtual machine instance view. + * + * @return the instanceView value. + */ + public VirtualMachineInstanceView instanceView() { + return this.instanceView; + } + + /** + * Get the status property: The observed state of virtual machine instances. + * + * @return the status value. + */ + public VirtualMachineInstanceStatus status() { + return this.status; + } + + /** + * Get the guestAgentInstallStatus property: Guest agent install status. + * + * @return the guestAgentInstallStatus value. + */ + public GuestAgentInstallStatus guestAgentInstallStatus() { + return this.guestAgentInstallStatus; + } + + /** + * Set the guestAgentInstallStatus property: Guest agent install status. + * + * @param guestAgentInstallStatus the guestAgentInstallStatus value to set. + * @return the VirtualMachineInstanceProperties object itself. + */ + public VirtualMachineInstanceProperties + withGuestAgentInstallStatus(GuestAgentInstallStatus guestAgentInstallStatus) { + this.guestAgentInstallStatus = guestAgentInstallStatus; + return this; + } + + /** + * Get the vmId property: Unique identifier for the vm resource. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Get the resourceUid property: Unique identifier defined by ARC to identify the guest of the VM. + * + * @return the resourceUid value. + */ + public String resourceUid() { + return this.resourceUid; + } + + /** + * Set the resourceUid property: Unique identifier defined by ARC to identify the guest of the VM. + * + * @param resourceUid the resourceUid value to set. + * @return the VirtualMachineInstanceProperties object itself. + */ + public VirtualMachineInstanceProperties withResourceUid(String resourceUid) { + this.resourceUid = resourceUid; + return this; + } + + /** + * Get the hyperVVmId property: Unique identifier for the Hyper-V VM resource. + * + * @return the hyperVVmId value. + */ + public String hyperVVmId() { + return this.hyperVVmId; + } + + /** + * Get the hostNodeName property: Name of the host node that the VM is on. + * + * @return the hostNodeName value. + */ + public String hostNodeName() { + return this.hostNodeName; + } + + /** + * Get the hostNodeIpAddress property: Name of the host node that the VM is on. + * + * @return the hostNodeIpAddress value. + */ + public String hostNodeIpAddress() { + return this.hostNodeIpAddress; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hardwareProfile() != null) { + hardwareProfile().validate(); + } + if (placementProfile() != null) { + placementProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (osProfile() != null) { + osProfile().validate(); + } + if (securityProfile() != null) { + securityProfile().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + if (httpProxyConfig() != null) { + httpProxyConfig().validate(); + } + if (instanceView() != null) { + instanceView().validate(); + } + if (status() != null) { + status().validate(); + } + if (guestAgentInstallStatus() != null) { + guestAgentInstallStatus().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("hardwareProfile", this.hardwareProfile); + jsonWriter.writeJsonField("placementProfile", this.placementProfile); + jsonWriter.writeJsonField("networkProfile", this.networkProfile); + jsonWriter.writeJsonField("osProfile", this.osProfile); + jsonWriter.writeJsonField("securityProfile", this.securityProfile); + jsonWriter.writeJsonField("storageProfile", this.storageProfile); + jsonWriter.writeJsonField("httpProxyConfig", this.httpProxyConfig); + jsonWriter.writeBooleanField("createFromLocal", this.createFromLocal); + jsonWriter.writeJsonField("guestAgentInstallStatus", this.guestAgentInstallStatus); + jsonWriter.writeStringField("resourceUid", this.resourceUid); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstanceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstanceProperties 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 VirtualMachineInstanceProperties. + */ + public static VirtualMachineInstanceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstanceProperties deserializedVirtualMachineInstanceProperties + = new VirtualMachineInstanceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("hardwareProfile".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.hardwareProfile + = VirtualMachineInstancePropertiesHardwareProfile.fromJson(reader); + } else if ("placementProfile".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.placementProfile + = VirtualMachineInstancePropertiesPlacementProfile.fromJson(reader); + } else if ("networkProfile".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.networkProfile + = VirtualMachineInstancePropertiesNetworkProfile.fromJson(reader); + } else if ("osProfile".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.osProfile + = VirtualMachineInstancePropertiesOsProfile.fromJson(reader); + } else if ("securityProfile".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.securityProfile + = VirtualMachineInstancePropertiesSecurityProfile.fromJson(reader); + } else if ("storageProfile".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.storageProfile + = VirtualMachineInstancePropertiesStorageProfile.fromJson(reader); + } else if ("httpProxyConfig".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.httpProxyConfig + = HttpProxyConfiguration.fromJson(reader); + } else if ("createFromLocal".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.createFromLocal + = reader.getNullable(JsonReader::getBoolean); + } else if ("provisioningState".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.provisioningState + = ProvisioningStateEnum.fromString(reader.getString()); + } else if ("instanceView".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.instanceView + = VirtualMachineInstanceView.fromJson(reader); + } else if ("status".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.status = VirtualMachineInstanceStatus.fromJson(reader); + } else if ("guestAgentInstallStatus".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.guestAgentInstallStatus + = GuestAgentInstallStatus.fromJson(reader); + } else if ("vmId".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.vmId = reader.getString(); + } else if ("resourceUid".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.resourceUid = reader.getString(); + } else if ("hyperVVmId".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.hyperVVmId = reader.getString(); + } else if ("hostNodeName".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.hostNodeName = reader.getString(); + } else if ("hostNodeIpAddress".equals(fieldName)) { + deserializedVirtualMachineInstanceProperties.hostNodeIpAddress = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstanceProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesHardwareProfile.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesHardwareProfile.java new file mode 100644 index 000000000000..43625d0b5d1c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesHardwareProfile.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * HardwareProfile - Specifies the hardware settings for the virtual machine instance. + */ +@Fluent +public final class VirtualMachineInstancePropertiesHardwareProfile + implements JsonSerializable { + /* + * Enum of VM Sizes + */ + private VmSizeEnum vmSize; + + /* + * number of processors for the virtual machine instance + */ + private Integer processors; + + /* + * RAM in MB for the virtual machine instance + */ + private Long memoryMB; + + /* + * Dynamic memory config + */ + private VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig dynamicMemoryConfig; + + /* + * virtualMachineGPUs - list of gpus to be attached to the virtual machine instance + */ + private List virtualMachineGPUs; + + /** + * Creates an instance of VirtualMachineInstancePropertiesHardwareProfile class. + */ + public VirtualMachineInstancePropertiesHardwareProfile() { + } + + /** + * Get the vmSize property: Enum of VM Sizes. + * + * @return the vmSize value. + */ + public VmSizeEnum vmSize() { + return this.vmSize; + } + + /** + * Set the vmSize property: Enum of VM Sizes. + * + * @param vmSize the vmSize value to set. + * @return the VirtualMachineInstancePropertiesHardwareProfile object itself. + */ + public VirtualMachineInstancePropertiesHardwareProfile withVmSize(VmSizeEnum vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get the processors property: number of processors for the virtual machine instance. + * + * @return the processors value. + */ + public Integer processors() { + return this.processors; + } + + /** + * Set the processors property: number of processors for the virtual machine instance. + * + * @param processors the processors value to set. + * @return the VirtualMachineInstancePropertiesHardwareProfile object itself. + */ + public VirtualMachineInstancePropertiesHardwareProfile withProcessors(Integer processors) { + this.processors = processors; + return this; + } + + /** + * Get the memoryMB property: RAM in MB for the virtual machine instance. + * + * @return the memoryMB value. + */ + public Long memoryMB() { + return this.memoryMB; + } + + /** + * Set the memoryMB property: RAM in MB for the virtual machine instance. + * + * @param memoryMB the memoryMB value to set. + * @return the VirtualMachineInstancePropertiesHardwareProfile object itself. + */ + public VirtualMachineInstancePropertiesHardwareProfile withMemoryMB(Long memoryMB) { + this.memoryMB = memoryMB; + return this; + } + + /** + * Get the dynamicMemoryConfig property: Dynamic memory config. + * + * @return the dynamicMemoryConfig value. + */ + public VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig dynamicMemoryConfig() { + return this.dynamicMemoryConfig; + } + + /** + * Set the dynamicMemoryConfig property: Dynamic memory config. + * + * @param dynamicMemoryConfig the dynamicMemoryConfig value to set. + * @return the VirtualMachineInstancePropertiesHardwareProfile object itself. + */ + public VirtualMachineInstancePropertiesHardwareProfile withDynamicMemoryConfig( + VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig dynamicMemoryConfig) { + this.dynamicMemoryConfig = dynamicMemoryConfig; + return this; + } + + /** + * Get the virtualMachineGPUs property: virtualMachineGPUs - list of gpus to be attached to the virtual machine + * instance. + * + * @return the virtualMachineGPUs value. + */ + public List virtualMachineGPUs() { + return this.virtualMachineGPUs; + } + + /** + * Set the virtualMachineGPUs property: virtualMachineGPUs - list of gpus to be attached to the virtual machine + * instance. + * + * @param virtualMachineGPUs the virtualMachineGPUs value to set. + * @return the VirtualMachineInstancePropertiesHardwareProfile object itself. + */ + public VirtualMachineInstancePropertiesHardwareProfile withVirtualMachineGPUs( + List virtualMachineGPUs) { + this.virtualMachineGPUs = virtualMachineGPUs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dynamicMemoryConfig() != null) { + dynamicMemoryConfig().validate(); + } + if (virtualMachineGPUs() != null) { + virtualMachineGPUs().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("vmSize", this.vmSize == null ? null : this.vmSize.toString()); + jsonWriter.writeNumberField("processors", this.processors); + jsonWriter.writeNumberField("memoryMB", this.memoryMB); + jsonWriter.writeJsonField("dynamicMemoryConfig", this.dynamicMemoryConfig); + jsonWriter.writeArrayField("virtualMachineGPUs", this.virtualMachineGPUs, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesHardwareProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesHardwareProfile 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 VirtualMachineInstancePropertiesHardwareProfile. + */ + public static VirtualMachineInstancePropertiesHardwareProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesHardwareProfile deserializedVirtualMachineInstancePropertiesHardwareProfile + = new VirtualMachineInstancePropertiesHardwareProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vmSize".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesHardwareProfile.vmSize + = VmSizeEnum.fromString(reader.getString()); + } else if ("processors".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesHardwareProfile.processors + = reader.getNullable(JsonReader::getInt); + } else if ("memoryMB".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesHardwareProfile.memoryMB + = reader.getNullable(JsonReader::getLong); + } else if ("dynamicMemoryConfig".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesHardwareProfile.dynamicMemoryConfig + = VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.fromJson(reader); + } else if ("virtualMachineGPUs".equals(fieldName)) { + List virtualMachineGPUs + = reader.readArray(reader1 -> VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU + .fromJson(reader1)); + deserializedVirtualMachineInstancePropertiesHardwareProfile.virtualMachineGPUs = virtualMachineGPUs; + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesHardwareProfile; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.java new file mode 100644 index 000000000000..85080c94ec1a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Dynamic memory config. + */ +@Fluent +public final class VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig + implements JsonSerializable { + /* + * Maximum memory in MB + */ + private Long maximumMemoryMB; + + /* + * Minimum memory in MB + */ + private Long minimumMemoryMB; + + /* + * Defines the amount of extra memory that should be reserved for a virtual machine instance at runtime, as a + * percentage of the total memory that the virtual machine instance is thought to need. This only applies to virtual + * systems with dynamic memory enabled. This property can be in the range of 5 to 2000. + */ + private Integer targetMemoryBuffer; + + /** + * Creates an instance of VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig class. + */ + public VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig() { + } + + /** + * Get the maximumMemoryMB property: Maximum memory in MB. + * + * @return the maximumMemoryMB value. + */ + public Long maximumMemoryMB() { + return this.maximumMemoryMB; + } + + /** + * Set the maximumMemoryMB property: Maximum memory in MB. + * + * @param maximumMemoryMB the maximumMemoryMB value to set. + * @return the VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig object itself. + */ + public VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig + withMaximumMemoryMB(Long maximumMemoryMB) { + this.maximumMemoryMB = maximumMemoryMB; + return this; + } + + /** + * Get the minimumMemoryMB property: Minimum memory in MB. + * + * @return the minimumMemoryMB value. + */ + public Long minimumMemoryMB() { + return this.minimumMemoryMB; + } + + /** + * Set the minimumMemoryMB property: Minimum memory in MB. + * + * @param minimumMemoryMB the minimumMemoryMB value to set. + * @return the VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig object itself. + */ + public VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig + withMinimumMemoryMB(Long minimumMemoryMB) { + this.minimumMemoryMB = minimumMemoryMB; + return this; + } + + /** + * Get the targetMemoryBuffer property: Defines the amount of extra memory that should be reserved for a virtual + * machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to + * need. This only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to + * 2000. + * + * @return the targetMemoryBuffer value. + */ + public Integer targetMemoryBuffer() { + return this.targetMemoryBuffer; + } + + /** + * Set the targetMemoryBuffer property: Defines the amount of extra memory that should be reserved for a virtual + * machine instance at runtime, as a percentage of the total memory that the virtual machine instance is thought to + * need. This only applies to virtual systems with dynamic memory enabled. This property can be in the range of 5 to + * 2000. + * + * @param targetMemoryBuffer the targetMemoryBuffer value to set. + * @return the VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig object itself. + */ + public VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig + withTargetMemoryBuffer(Integer targetMemoryBuffer) { + this.targetMemoryBuffer = targetMemoryBuffer; + 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("maximumMemoryMB", this.maximumMemoryMB); + jsonWriter.writeNumberField("minimumMemoryMB", this.minimumMemoryMB); + jsonWriter.writeNumberField("targetMemoryBuffer", this.targetMemoryBuffer); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig 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 + * VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig. + */ + public static VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig deserializedVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig + = new VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("maximumMemoryMB".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.maximumMemoryMB + = reader.getNullable(JsonReader::getLong); + } else if ("minimumMemoryMB".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.minimumMemoryMB + = reader.getNullable(JsonReader::getLong); + } else if ("targetMemoryBuffer".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.targetMemoryBuffer + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU.java new file mode 100644 index 000000000000..e8a693ac4e37 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * GPU properties - describes the GPU configuration. + */ +@Fluent +public final class VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU + implements JsonSerializable { + /* + * GPU assignment type + */ + private GpuAssignmentTypeEnum assignmentType; + + /* + * Size of gpu partition in MB for GPU-P + */ + private Long partitionSizeMB; + + /* + * Name of the GPU + */ + private String gpuName; + + /** + * Creates an instance of VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU class. + */ + public VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() { + } + + /** + * Get the assignmentType property: GPU assignment type. + * + * @return the assignmentType value. + */ + public GpuAssignmentTypeEnum assignmentType() { + return this.assignmentType; + } + + /** + * Set the assignmentType property: GPU assignment type. + * + * @param assignmentType the assignmentType value to set. + * @return the VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU object itself. + */ + public VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU + withAssignmentType(GpuAssignmentTypeEnum assignmentType) { + this.assignmentType = assignmentType; + return this; + } + + /** + * Get the partitionSizeMB property: Size of gpu partition in MB for GPU-P. + * + * @return the partitionSizeMB value. + */ + public Long partitionSizeMB() { + return this.partitionSizeMB; + } + + /** + * Set the partitionSizeMB property: Size of gpu partition in MB for GPU-P. + * + * @param partitionSizeMB the partitionSizeMB value to set. + * @return the VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU object itself. + */ + public VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU withPartitionSizeMB(Long partitionSizeMB) { + this.partitionSizeMB = partitionSizeMB; + return this; + } + + /** + * Get the gpuName property: Name of the GPU. + * + * @return the gpuName value. + */ + public String gpuName() { + return this.gpuName; + } + + /** + * Set the gpuName property: Name of the GPU. + * + * @param gpuName the gpuName value to set. + * @return the VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU object itself. + */ + public VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU withGpuName(String gpuName) { + this.gpuName = gpuName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (assignmentType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property assignmentType in model VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU")); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("assignmentType", + this.assignmentType == null ? null : this.assignmentType.toString()); + jsonWriter.writeNumberField("partitionSizeMB", this.partitionSizeMB); + jsonWriter.writeStringField("gpuName", this.gpuName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU 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 + * VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU. + */ + public static VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU deserializedVirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU + = new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("assignmentType".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU.assignmentType + = GpuAssignmentTypeEnum.fromString(reader.getString()); + } else if ("partitionSizeMB".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU.partitionSizeMB + = reader.getNullable(JsonReader::getLong); + } else if ("gpuName".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU.gpuName + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesNetworkProfile.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesNetworkProfile.java new file mode 100644 index 000000000000..c5ef51735e84 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesNetworkProfile.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * NetworkProfile - describes the network configuration the virtual machine instance. + */ +@Fluent +public final class VirtualMachineInstancePropertiesNetworkProfile + implements JsonSerializable { + /* + * NetworkInterfaces - list of network interfaces to be attached to the virtual machine instance + */ + private List networkInterfaces; + + /** + * Creates an instance of VirtualMachineInstancePropertiesNetworkProfile class. + */ + public VirtualMachineInstancePropertiesNetworkProfile() { + } + + /** + * Get the networkInterfaces property: NetworkInterfaces - list of network interfaces to be attached to the virtual + * machine instance. + * + * @return the networkInterfaces value. + */ + public List networkInterfaces() { + return this.networkInterfaces; + } + + /** + * Set the networkInterfaces property: NetworkInterfaces - list of network interfaces to be attached to the virtual + * machine instance. + * + * @param networkInterfaces the networkInterfaces value to set. + * @return the VirtualMachineInstancePropertiesNetworkProfile object itself. + */ + public VirtualMachineInstancePropertiesNetworkProfile + withNetworkInterfaces(List networkInterfaces) { + this.networkInterfaces = networkInterfaces; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkInterfaces() != null) { + networkInterfaces().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("networkInterfaces", this.networkInterfaces, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesNetworkProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesNetworkProfile 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 VirtualMachineInstancePropertiesNetworkProfile. + */ + public static VirtualMachineInstancePropertiesNetworkProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesNetworkProfile deserializedVirtualMachineInstancePropertiesNetworkProfile + = new VirtualMachineInstancePropertiesNetworkProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("networkInterfaces".equals(fieldName)) { + List networkInterfaces + = reader.readArray(reader1 -> NetworkInterfaceArmReference.fromJson(reader1)); + deserializedVirtualMachineInstancePropertiesNetworkProfile.networkInterfaces = networkInterfaces; + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesNetworkProfile; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesOsProfile.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesOsProfile.java new file mode 100644 index 000000000000..8834ccc68d86 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesOsProfile.java @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * OsProfile - describes the configuration of the operating system and sets login data. + */ +@Fluent +public final class VirtualMachineInstancePropertiesOsProfile + implements JsonSerializable { + /* + * AdminPassword - admin password + */ + private String adminPassword; + + /* + * AdminUsername - admin username + */ + private String adminUsername; + + /* + * ComputerName - name of the compute + */ + private String computerName; + + /* + * LinuxConfiguration - linux specific configuration values for the virtual machine instance + */ + private VirtualMachineInstancePropertiesOsProfileLinuxConfiguration linuxConfiguration; + + /* + * Windows Configuration for the virtual machine instance + */ + private VirtualMachineInstancePropertiesOsProfileWindowsConfiguration windowsConfiguration; + + /** + * Creates an instance of VirtualMachineInstancePropertiesOsProfile class. + */ + public VirtualMachineInstancePropertiesOsProfile() { + } + + /** + * Get the adminPassword property: AdminPassword - admin password. + * + * @return the adminPassword value. + */ + public String adminPassword() { + return this.adminPassword; + } + + /** + * Set the adminPassword property: AdminPassword - admin password. + * + * @param adminPassword the adminPassword value to set. + * @return the VirtualMachineInstancePropertiesOsProfile object itself. + */ + public VirtualMachineInstancePropertiesOsProfile withAdminPassword(String adminPassword) { + this.adminPassword = adminPassword; + return this; + } + + /** + * Get the adminUsername property: AdminUsername - admin username. + * + * @return the adminUsername value. + */ + public String adminUsername() { + return this.adminUsername; + } + + /** + * Set the adminUsername property: AdminUsername - admin username. + * + * @param adminUsername the adminUsername value to set. + * @return the VirtualMachineInstancePropertiesOsProfile object itself. + */ + public VirtualMachineInstancePropertiesOsProfile withAdminUsername(String adminUsername) { + this.adminUsername = adminUsername; + return this; + } + + /** + * Get the computerName property: ComputerName - name of the compute. + * + * @return the computerName value. + */ + public String computerName() { + return this.computerName; + } + + /** + * Set the computerName property: ComputerName - name of the compute. + * + * @param computerName the computerName value to set. + * @return the VirtualMachineInstancePropertiesOsProfile object itself. + */ + public VirtualMachineInstancePropertiesOsProfile withComputerName(String computerName) { + this.computerName = computerName; + return this; + } + + /** + * Get the linuxConfiguration property: LinuxConfiguration - linux specific configuration values for the virtual + * machine instance. + * + * @return the linuxConfiguration value. + */ + public VirtualMachineInstancePropertiesOsProfileLinuxConfiguration linuxConfiguration() { + return this.linuxConfiguration; + } + + /** + * Set the linuxConfiguration property: LinuxConfiguration - linux specific configuration values for the virtual + * machine instance. + * + * @param linuxConfiguration the linuxConfiguration value to set. + * @return the VirtualMachineInstancePropertiesOsProfile object itself. + */ + public VirtualMachineInstancePropertiesOsProfile + withLinuxConfiguration(VirtualMachineInstancePropertiesOsProfileLinuxConfiguration linuxConfiguration) { + this.linuxConfiguration = linuxConfiguration; + return this; + } + + /** + * Get the windowsConfiguration property: Windows Configuration for the virtual machine instance. + * + * @return the windowsConfiguration value. + */ + public VirtualMachineInstancePropertiesOsProfileWindowsConfiguration windowsConfiguration() { + return this.windowsConfiguration; + } + + /** + * Set the windowsConfiguration property: Windows Configuration for the virtual machine instance. + * + * @param windowsConfiguration the windowsConfiguration value to set. + * @return the VirtualMachineInstancePropertiesOsProfile object itself. + */ + public VirtualMachineInstancePropertiesOsProfile + withWindowsConfiguration(VirtualMachineInstancePropertiesOsProfileWindowsConfiguration windowsConfiguration) { + this.windowsConfiguration = windowsConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (linuxConfiguration() != null) { + linuxConfiguration().validate(); + } + if (windowsConfiguration() != null) { + windowsConfiguration().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("adminPassword", this.adminPassword); + jsonWriter.writeStringField("adminUsername", this.adminUsername); + jsonWriter.writeStringField("computerName", this.computerName); + jsonWriter.writeJsonField("linuxConfiguration", this.linuxConfiguration); + jsonWriter.writeJsonField("windowsConfiguration", this.windowsConfiguration); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesOsProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesOsProfile 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 VirtualMachineInstancePropertiesOsProfile. + */ + public static VirtualMachineInstancePropertiesOsProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesOsProfile deserializedVirtualMachineInstancePropertiesOsProfile + = new VirtualMachineInstancePropertiesOsProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("adminPassword".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfile.adminPassword = reader.getString(); + } else if ("adminUsername".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfile.adminUsername = reader.getString(); + } else if ("computerName".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfile.computerName = reader.getString(); + } else if ("linuxConfiguration".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfile.linuxConfiguration + = VirtualMachineInstancePropertiesOsProfileLinuxConfiguration.fromJson(reader); + } else if ("windowsConfiguration".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfile.windowsConfiguration + = VirtualMachineInstancePropertiesOsProfileWindowsConfiguration.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesOsProfile; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesOsProfileLinuxConfiguration.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesOsProfileLinuxConfiguration.java new file mode 100644 index 000000000000..936dcaee41ad --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesOsProfileLinuxConfiguration.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * LinuxConfiguration - linux specific configuration values for the virtual machine instance. + */ +@Fluent +public final class VirtualMachineInstancePropertiesOsProfileLinuxConfiguration + implements JsonSerializable { + /* + * DisablePasswordAuthentication - whether password authentication should be disabled + */ + private Boolean disablePasswordAuthentication; + + /* + * Specifies the ssh key configuration for a Linux OS. + */ + private SshConfiguration ssh; + + /* + * Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance + * creation process. + */ + private Boolean provisionVMAgent; + + /* + * Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + */ + private Boolean provisionVMConfigAgent; + + /** + * Creates an instance of VirtualMachineInstancePropertiesOsProfileLinuxConfiguration class. + */ + public VirtualMachineInstancePropertiesOsProfileLinuxConfiguration() { + } + + /** + * Get the disablePasswordAuthentication property: DisablePasswordAuthentication - whether password authentication + * should be disabled. + * + * @return the disablePasswordAuthentication value. + */ + public Boolean disablePasswordAuthentication() { + return this.disablePasswordAuthentication; + } + + /** + * Set the disablePasswordAuthentication property: DisablePasswordAuthentication - whether password authentication + * should be disabled. + * + * @param disablePasswordAuthentication the disablePasswordAuthentication value to set. + * @return the VirtualMachineInstancePropertiesOsProfileLinuxConfiguration object itself. + */ + public VirtualMachineInstancePropertiesOsProfileLinuxConfiguration + withDisablePasswordAuthentication(Boolean disablePasswordAuthentication) { + this.disablePasswordAuthentication = disablePasswordAuthentication; + return this; + } + + /** + * Get the ssh property: Specifies the ssh key configuration for a Linux OS. + * + * @return the ssh value. + */ + public SshConfiguration ssh() { + return this.ssh; + } + + /** + * Set the ssh property: Specifies the ssh key configuration for a Linux OS. + * + * @param ssh the ssh value to set. + * @return the VirtualMachineInstancePropertiesOsProfileLinuxConfiguration object itself. + */ + public VirtualMachineInstancePropertiesOsProfileLinuxConfiguration withSsh(SshConfiguration ssh) { + this.ssh = ssh; + return this; + } + + /** + * Get the provisionVMAgent property: Used to indicate whether Arc for Servers agent onboarding should be triggered + * during the virtual machine instance creation process. + * + * @return the provisionVMAgent value. + */ + public Boolean provisionVMAgent() { + return this.provisionVMAgent; + } + + /** + * Set the provisionVMAgent property: Used to indicate whether Arc for Servers agent onboarding should be triggered + * during the virtual machine instance creation process. + * + * @param provisionVMAgent the provisionVMAgent value to set. + * @return the VirtualMachineInstancePropertiesOsProfileLinuxConfiguration object itself. + */ + public VirtualMachineInstancePropertiesOsProfileLinuxConfiguration withProvisionVMAgent(Boolean provisionVMAgent) { + this.provisionVMAgent = provisionVMAgent; + return this; + } + + /** + * Get the provisionVMConfigAgent property: Used to indicate whether the VM Config Agent should be installed during + * the virtual machine creation process. + * + * @return the provisionVMConfigAgent value. + */ + public Boolean provisionVMConfigAgent() { + return this.provisionVMConfigAgent; + } + + /** + * Set the provisionVMConfigAgent property: Used to indicate whether the VM Config Agent should be installed during + * the virtual machine creation process. + * + * @param provisionVMConfigAgent the provisionVMConfigAgent value to set. + * @return the VirtualMachineInstancePropertiesOsProfileLinuxConfiguration object itself. + */ + public VirtualMachineInstancePropertiesOsProfileLinuxConfiguration + withProvisionVMConfigAgent(Boolean provisionVMConfigAgent) { + this.provisionVMConfigAgent = provisionVMConfigAgent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ssh() != null) { + ssh().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("disablePasswordAuthentication", this.disablePasswordAuthentication); + jsonWriter.writeJsonField("ssh", this.ssh); + jsonWriter.writeBooleanField("provisionVMAgent", this.provisionVMAgent); + jsonWriter.writeBooleanField("provisionVMConfigAgent", this.provisionVMConfigAgent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesOsProfileLinuxConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesOsProfileLinuxConfiguration 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 + * VirtualMachineInstancePropertiesOsProfileLinuxConfiguration. + */ + public static VirtualMachineInstancePropertiesOsProfileLinuxConfiguration fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesOsProfileLinuxConfiguration deserializedVirtualMachineInstancePropertiesOsProfileLinuxConfiguration + = new VirtualMachineInstancePropertiesOsProfileLinuxConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("disablePasswordAuthentication".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfileLinuxConfiguration.disablePasswordAuthentication + = reader.getNullable(JsonReader::getBoolean); + } else if ("ssh".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfileLinuxConfiguration.ssh + = SshConfiguration.fromJson(reader); + } else if ("provisionVMAgent".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfileLinuxConfiguration.provisionVMAgent + = reader.getNullable(JsonReader::getBoolean); + } else if ("provisionVMConfigAgent".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfileLinuxConfiguration.provisionVMConfigAgent + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesOsProfileLinuxConfiguration; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesOsProfileWindowsConfiguration.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesOsProfileWindowsConfiguration.java new file mode 100644 index 000000000000..41ff0c343724 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesOsProfileWindowsConfiguration.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Windows Configuration for the virtual machine instance. + */ +@Fluent +public final class VirtualMachineInstancePropertiesOsProfileWindowsConfiguration + implements JsonSerializable { + /* + * Whether to EnableAutomaticUpdates on the machine + */ + private Boolean enableAutomaticUpdates; + + /* + * Specifies the ssh key configuration for Windows OS. + */ + private SshConfiguration ssh; + + /* + * TimeZone for the virtual machine instance + */ + private String timeZone; + + /* + * Used to indicate whether Arc for Servers agent onboarding should be triggered during the virtual machine instance + * creation process. + */ + private Boolean provisionVMAgent; + + /* + * Used to indicate whether the VM Config Agent should be installed during the virtual machine creation process. + */ + private Boolean provisionVMConfigAgent; + + /** + * Creates an instance of VirtualMachineInstancePropertiesOsProfileWindowsConfiguration class. + */ + public VirtualMachineInstancePropertiesOsProfileWindowsConfiguration() { + } + + /** + * Get the enableAutomaticUpdates property: Whether to EnableAutomaticUpdates on the machine. + * + * @return the enableAutomaticUpdates value. + */ + public Boolean enableAutomaticUpdates() { + return this.enableAutomaticUpdates; + } + + /** + * Set the enableAutomaticUpdates property: Whether to EnableAutomaticUpdates on the machine. + * + * @param enableAutomaticUpdates the enableAutomaticUpdates value to set. + * @return the VirtualMachineInstancePropertiesOsProfileWindowsConfiguration object itself. + */ + public VirtualMachineInstancePropertiesOsProfileWindowsConfiguration + withEnableAutomaticUpdates(Boolean enableAutomaticUpdates) { + this.enableAutomaticUpdates = enableAutomaticUpdates; + return this; + } + + /** + * Get the ssh property: Specifies the ssh key configuration for Windows OS. + * + * @return the ssh value. + */ + public SshConfiguration ssh() { + return this.ssh; + } + + /** + * Set the ssh property: Specifies the ssh key configuration for Windows OS. + * + * @param ssh the ssh value to set. + * @return the VirtualMachineInstancePropertiesOsProfileWindowsConfiguration object itself. + */ + public VirtualMachineInstancePropertiesOsProfileWindowsConfiguration withSsh(SshConfiguration ssh) { + this.ssh = ssh; + return this; + } + + /** + * Get the timeZone property: TimeZone for the virtual machine instance. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: TimeZone for the virtual machine instance. + * + * @param timeZone the timeZone value to set. + * @return the VirtualMachineInstancePropertiesOsProfileWindowsConfiguration object itself. + */ + public VirtualMachineInstancePropertiesOsProfileWindowsConfiguration withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the provisionVMAgent property: Used to indicate whether Arc for Servers agent onboarding should be triggered + * during the virtual machine instance creation process. + * + * @return the provisionVMAgent value. + */ + public Boolean provisionVMAgent() { + return this.provisionVMAgent; + } + + /** + * Set the provisionVMAgent property: Used to indicate whether Arc for Servers agent onboarding should be triggered + * during the virtual machine instance creation process. + * + * @param provisionVMAgent the provisionVMAgent value to set. + * @return the VirtualMachineInstancePropertiesOsProfileWindowsConfiguration object itself. + */ + public VirtualMachineInstancePropertiesOsProfileWindowsConfiguration + withProvisionVMAgent(Boolean provisionVMAgent) { + this.provisionVMAgent = provisionVMAgent; + return this; + } + + /** + * Get the provisionVMConfigAgent property: Used to indicate whether the VM Config Agent should be installed during + * the virtual machine creation process. + * + * @return the provisionVMConfigAgent value. + */ + public Boolean provisionVMConfigAgent() { + return this.provisionVMConfigAgent; + } + + /** + * Set the provisionVMConfigAgent property: Used to indicate whether the VM Config Agent should be installed during + * the virtual machine creation process. + * + * @param provisionVMConfigAgent the provisionVMConfigAgent value to set. + * @return the VirtualMachineInstancePropertiesOsProfileWindowsConfiguration object itself. + */ + public VirtualMachineInstancePropertiesOsProfileWindowsConfiguration + withProvisionVMConfigAgent(Boolean provisionVMConfigAgent) { + this.provisionVMConfigAgent = provisionVMConfigAgent; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ssh() != null) { + ssh().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enableAutomaticUpdates", this.enableAutomaticUpdates); + jsonWriter.writeJsonField("ssh", this.ssh); + jsonWriter.writeStringField("timeZone", this.timeZone); + jsonWriter.writeBooleanField("provisionVMAgent", this.provisionVMAgent); + jsonWriter.writeBooleanField("provisionVMConfigAgent", this.provisionVMConfigAgent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesOsProfileWindowsConfiguration from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesOsProfileWindowsConfiguration 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 + * VirtualMachineInstancePropertiesOsProfileWindowsConfiguration. + */ + public static VirtualMachineInstancePropertiesOsProfileWindowsConfiguration fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesOsProfileWindowsConfiguration deserializedVirtualMachineInstancePropertiesOsProfileWindowsConfiguration + = new VirtualMachineInstancePropertiesOsProfileWindowsConfiguration(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enableAutomaticUpdates".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfileWindowsConfiguration.enableAutomaticUpdates + = reader.getNullable(JsonReader::getBoolean); + } else if ("ssh".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfileWindowsConfiguration.ssh + = SshConfiguration.fromJson(reader); + } else if ("timeZone".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfileWindowsConfiguration.timeZone + = reader.getString(); + } else if ("provisionVMAgent".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfileWindowsConfiguration.provisionVMAgent + = reader.getNullable(JsonReader::getBoolean); + } else if ("provisionVMConfigAgent".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesOsProfileWindowsConfiguration.provisionVMConfigAgent + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesOsProfileWindowsConfiguration; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesPlacementProfile.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesPlacementProfile.java new file mode 100644 index 000000000000..1ef5204f59bf --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesPlacementProfile.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * PlacementProfile - Specifies the placement related settings for the virtual machine. + */ +@Fluent +public final class VirtualMachineInstancePropertiesPlacementProfile + implements JsonSerializable { + /* + * The zone in which the VM should be placed in. + */ + private String zone; + + /* + * Specifies whether VM can only failover strictly within the zone it was placed in + */ + private Boolean strictPlacementPolicy; + + /** + * Creates an instance of VirtualMachineInstancePropertiesPlacementProfile class. + */ + public VirtualMachineInstancePropertiesPlacementProfile() { + } + + /** + * Get the zone property: The zone in which the VM should be placed in. + * + * @return the zone value. + */ + public String zone() { + return this.zone; + } + + /** + * Set the zone property: The zone in which the VM should be placed in. + * + * @param zone the zone value to set. + * @return the VirtualMachineInstancePropertiesPlacementProfile object itself. + */ + public VirtualMachineInstancePropertiesPlacementProfile withZone(String zone) { + this.zone = zone; + return this; + } + + /** + * Get the strictPlacementPolicy property: Specifies whether VM can only failover strictly within the zone it was + * placed in. + * + * @return the strictPlacementPolicy value. + */ + public Boolean strictPlacementPolicy() { + return this.strictPlacementPolicy; + } + + /** + * Set the strictPlacementPolicy property: Specifies whether VM can only failover strictly within the zone it was + * placed in. + * + * @param strictPlacementPolicy the strictPlacementPolicy value to set. + * @return the VirtualMachineInstancePropertiesPlacementProfile object itself. + */ + public VirtualMachineInstancePropertiesPlacementProfile withStrictPlacementPolicy(Boolean strictPlacementPolicy) { + this.strictPlacementPolicy = strictPlacementPolicy; + 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("zone", this.zone); + jsonWriter.writeBooleanField("strictPlacementPolicy", this.strictPlacementPolicy); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesPlacementProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesPlacementProfile 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 VirtualMachineInstancePropertiesPlacementProfile. + */ + public static VirtualMachineInstancePropertiesPlacementProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesPlacementProfile deserializedVirtualMachineInstancePropertiesPlacementProfile + = new VirtualMachineInstancePropertiesPlacementProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("zone".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesPlacementProfile.zone = reader.getString(); + } else if ("strictPlacementPolicy".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesPlacementProfile.strictPlacementPolicy + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesPlacementProfile; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesSecurityProfile.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesSecurityProfile.java new file mode 100644 index 000000000000..3df098b78953 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesSecurityProfile.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * SecurityProfile - Specifies the security settings for the virtual machine instance. + */ +@Fluent +public final class VirtualMachineInstancePropertiesSecurityProfile + implements JsonSerializable { + /* + * Enable TPM flag + */ + private Boolean enableTPM; + + /* + * Uefi settings of the virtual machine instance + */ + private VirtualMachineInstancePropertiesSecurityProfileUefiSettings uefiSettings; + + /* + * Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled must be set to true for + * SecurityType to function. + */ + private SecurityTypes securityType; + + /** + * Creates an instance of VirtualMachineInstancePropertiesSecurityProfile class. + */ + public VirtualMachineInstancePropertiesSecurityProfile() { + } + + /** + * Get the enableTPM property: Enable TPM flag. + * + * @return the enableTPM value. + */ + public Boolean enableTPM() { + return this.enableTPM; + } + + /** + * Set the enableTPM property: Enable TPM flag. + * + * @param enableTPM the enableTPM value to set. + * @return the VirtualMachineInstancePropertiesSecurityProfile object itself. + */ + public VirtualMachineInstancePropertiesSecurityProfile withEnableTPM(Boolean enableTPM) { + this.enableTPM = enableTPM; + return this; + } + + /** + * Get the uefiSettings property: Uefi settings of the virtual machine instance. + * + * @return the uefiSettings value. + */ + public VirtualMachineInstancePropertiesSecurityProfileUefiSettings uefiSettings() { + return this.uefiSettings; + } + + /** + * Set the uefiSettings property: Uefi settings of the virtual machine instance. + * + * @param uefiSettings the uefiSettings value to set. + * @return the VirtualMachineInstancePropertiesSecurityProfile object itself. + */ + public VirtualMachineInstancePropertiesSecurityProfile + withUefiSettings(VirtualMachineInstancePropertiesSecurityProfileUefiSettings uefiSettings) { + this.uefiSettings = uefiSettings; + return this; + } + + /** + * Get the securityType property: Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled + * must be set to true for SecurityType to function. + * + * @return the securityType value. + */ + public SecurityTypes securityType() { + return this.securityType; + } + + /** + * Set the securityType property: Specifies the SecurityType of the virtual machine. EnableTPM and SecureBootEnabled + * must be set to true for SecurityType to function. + * + * @param securityType the securityType value to set. + * @return the VirtualMachineInstancePropertiesSecurityProfile object itself. + */ + public VirtualMachineInstancePropertiesSecurityProfile withSecurityType(SecurityTypes securityType) { + this.securityType = securityType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (uefiSettings() != null) { + uefiSettings().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enableTPM", this.enableTPM); + jsonWriter.writeJsonField("uefiSettings", this.uefiSettings); + jsonWriter.writeStringField("securityType", this.securityType == null ? null : this.securityType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesSecurityProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesSecurityProfile 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 VirtualMachineInstancePropertiesSecurityProfile. + */ + public static VirtualMachineInstancePropertiesSecurityProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesSecurityProfile deserializedVirtualMachineInstancePropertiesSecurityProfile + = new VirtualMachineInstancePropertiesSecurityProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("enableTPM".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesSecurityProfile.enableTPM + = reader.getNullable(JsonReader::getBoolean); + } else if ("uefiSettings".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesSecurityProfile.uefiSettings + = VirtualMachineInstancePropertiesSecurityProfileUefiSettings.fromJson(reader); + } else if ("securityType".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesSecurityProfile.securityType + = SecurityTypes.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesSecurityProfile; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.java new file mode 100644 index 000000000000..e5c78800ccd3 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesSecurityProfileUefiSettings.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Uefi settings - Specifies whether secure boot should be enabled on the virtual machine instance. + */ +@Fluent +public final class VirtualMachineInstancePropertiesSecurityProfileUefiSettings + implements JsonSerializable { + /* + * Specifies whether secure boot should be enabled on the virtual machine instance. + */ + private Boolean secureBootEnabled; + + /** + * Creates an instance of VirtualMachineInstancePropertiesSecurityProfileUefiSettings class. + */ + public VirtualMachineInstancePropertiesSecurityProfileUefiSettings() { + } + + /** + * Get the secureBootEnabled property: Specifies whether secure boot should be enabled on the virtual machine + * instance. + * + * @return the secureBootEnabled value. + */ + public Boolean secureBootEnabled() { + return this.secureBootEnabled; + } + + /** + * Set the secureBootEnabled property: Specifies whether secure boot should be enabled on the virtual machine + * instance. + * + * @param secureBootEnabled the secureBootEnabled value to set. + * @return the VirtualMachineInstancePropertiesSecurityProfileUefiSettings object itself. + */ + public VirtualMachineInstancePropertiesSecurityProfileUefiSettings + withSecureBootEnabled(Boolean secureBootEnabled) { + this.secureBootEnabled = secureBootEnabled; + 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("secureBootEnabled", this.secureBootEnabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesSecurityProfileUefiSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesSecurityProfileUefiSettings 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 + * VirtualMachineInstancePropertiesSecurityProfileUefiSettings. + */ + public static VirtualMachineInstancePropertiesSecurityProfileUefiSettings fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesSecurityProfileUefiSettings deserializedVirtualMachineInstancePropertiesSecurityProfileUefiSettings + = new VirtualMachineInstancePropertiesSecurityProfileUefiSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("secureBootEnabled".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesSecurityProfileUefiSettings.secureBootEnabled + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesSecurityProfileUefiSettings; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesStorageProfile.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesStorageProfile.java new file mode 100644 index 000000000000..f32bfae7f64c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesStorageProfile.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * StorageProfile - contains information about the disks and storage information for the virtual machine instance. + */ +@Fluent +public final class VirtualMachineInstancePropertiesStorageProfile + implements JsonSerializable { + /* + * adds data disks to the virtual machine instance + */ + private List dataDisks; + + /* + * Which Image to use for the virtual machine instance + */ + private ImageArmReference imageReference; + + /* + * VHD to attach as OS disk + */ + private VirtualMachineInstancePropertiesStorageProfileOsDisk osDisk; + + /* + * Id of the storage container that hosts the VM configuration file + */ + private String vmConfigStoragePathId; + + /** + * Creates an instance of VirtualMachineInstancePropertiesStorageProfile class. + */ + public VirtualMachineInstancePropertiesStorageProfile() { + } + + /** + * Get the dataDisks property: adds data disks to the virtual machine instance. + * + * @return the dataDisks value. + */ + public List dataDisks() { + return this.dataDisks; + } + + /** + * Set the dataDisks property: adds data disks to the virtual machine instance. + * + * @param dataDisks the dataDisks value to set. + * @return the VirtualMachineInstancePropertiesStorageProfile object itself. + */ + public VirtualMachineInstancePropertiesStorageProfile withDataDisks(List dataDisks) { + this.dataDisks = dataDisks; + return this; + } + + /** + * Get the imageReference property: Which Image to use for the virtual machine instance. + * + * @return the imageReference value. + */ + public ImageArmReference imageReference() { + return this.imageReference; + } + + /** + * Set the imageReference property: Which Image to use for the virtual machine instance. + * + * @param imageReference the imageReference value to set. + * @return the VirtualMachineInstancePropertiesStorageProfile object itself. + */ + public VirtualMachineInstancePropertiesStorageProfile withImageReference(ImageArmReference imageReference) { + this.imageReference = imageReference; + return this; + } + + /** + * Get the osDisk property: VHD to attach as OS disk. + * + * @return the osDisk value. + */ + public VirtualMachineInstancePropertiesStorageProfileOsDisk osDisk() { + return this.osDisk; + } + + /** + * Set the osDisk property: VHD to attach as OS disk. + * + * @param osDisk the osDisk value to set. + * @return the VirtualMachineInstancePropertiesStorageProfile object itself. + */ + public VirtualMachineInstancePropertiesStorageProfile + withOsDisk(VirtualMachineInstancePropertiesStorageProfileOsDisk osDisk) { + this.osDisk = osDisk; + return this; + } + + /** + * Get the vmConfigStoragePathId property: Id of the storage container that hosts the VM configuration file. + * + * @return the vmConfigStoragePathId value. + */ + public String vmConfigStoragePathId() { + return this.vmConfigStoragePathId; + } + + /** + * Set the vmConfigStoragePathId property: Id of the storage container that hosts the VM configuration file. + * + * @param vmConfigStoragePathId the vmConfigStoragePathId value to set. + * @return the VirtualMachineInstancePropertiesStorageProfile object itself. + */ + public VirtualMachineInstancePropertiesStorageProfile withVmConfigStoragePathId(String vmConfigStoragePathId) { + this.vmConfigStoragePathId = vmConfigStoragePathId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataDisks() != null) { + dataDisks().forEach(e -> e.validate()); + } + if (imageReference() != null) { + imageReference().validate(); + } + if (osDisk() != null) { + osDisk().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("dataDisks", this.dataDisks, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("imageReference", this.imageReference); + jsonWriter.writeJsonField("osDisk", this.osDisk); + jsonWriter.writeStringField("vmConfigStoragePathId", this.vmConfigStoragePathId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesStorageProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesStorageProfile 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 VirtualMachineInstancePropertiesStorageProfile. + */ + public static VirtualMachineInstancePropertiesStorageProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesStorageProfile deserializedVirtualMachineInstancePropertiesStorageProfile + = new VirtualMachineInstancePropertiesStorageProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataDisks".equals(fieldName)) { + List dataDisks + = reader.readArray(reader1 -> VirtualHardDiskArmReference.fromJson(reader1)); + deserializedVirtualMachineInstancePropertiesStorageProfile.dataDisks = dataDisks; + } else if ("imageReference".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesStorageProfile.imageReference + = ImageArmReference.fromJson(reader); + } else if ("osDisk".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesStorageProfile.osDisk + = VirtualMachineInstancePropertiesStorageProfileOsDisk.fromJson(reader); + } else if ("vmConfigStoragePathId".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesStorageProfile.vmConfigStoragePathId + = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesStorageProfile; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesStorageProfileOsDisk.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesStorageProfileOsDisk.java new file mode 100644 index 000000000000..04260858381b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstancePropertiesStorageProfileOsDisk.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * VHD to attach as OS disk. + */ +@Fluent +public final class VirtualMachineInstancePropertiesStorageProfileOsDisk + implements JsonSerializable { + /* + * The ARM ID for a Virtual Hard Disk. + */ + private String id; + + /* + * This property allows you to specify the type of the OS that is included in the disk if creating a VM from + * user-image or a specialized VHD. Possible values are: Windows, Linux. + */ + private OperatingSystemTypes osType; + + /* + * The managed disk parameters. + */ + private VirtualMachineInstanceManagedDiskParameters managedDisk; + + /** + * Creates an instance of VirtualMachineInstancePropertiesStorageProfileOsDisk class. + */ + public VirtualMachineInstancePropertiesStorageProfileOsDisk() { + } + + /** + * Get the id property: The ARM ID for a Virtual Hard Disk. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM ID for a Virtual Hard Disk. + * + * @param id the id value to set. + * @return the VirtualMachineInstancePropertiesStorageProfileOsDisk object itself. + */ + public VirtualMachineInstancePropertiesStorageProfileOsDisk withId(String id) { + this.id = id; + return this; + } + + /** + * Get the osType property: This property allows you to specify the type of the OS that is included in the disk if + * creating a VM from user-image or a specialized VHD. Possible values are: Windows, Linux. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.osType; + } + + /** + * Set the osType property: This property allows you to specify the type of the OS that is included in the disk if + * creating a VM from user-image or a specialized VHD. Possible values are: Windows, Linux. + * + * @param osType the osType value to set. + * @return the VirtualMachineInstancePropertiesStorageProfileOsDisk object itself. + */ + public VirtualMachineInstancePropertiesStorageProfileOsDisk withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the managedDisk property: The managed disk parameters. + * + * @return the managedDisk value. + */ + public VirtualMachineInstanceManagedDiskParameters managedDisk() { + return this.managedDisk; + } + + /** + * Set the managedDisk property: The managed disk parameters. + * + * @param managedDisk the managedDisk value to set. + * @return the VirtualMachineInstancePropertiesStorageProfileOsDisk object itself. + */ + public VirtualMachineInstancePropertiesStorageProfileOsDisk + withManagedDisk(VirtualMachineInstanceManagedDiskParameters managedDisk) { + this.managedDisk = managedDisk; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (managedDisk() != null) { + managedDisk().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("osType", this.osType == null ? null : this.osType.toString()); + jsonWriter.writeJsonField("managedDisk", this.managedDisk); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstancePropertiesStorageProfileOsDisk from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstancePropertiesStorageProfileOsDisk 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 VirtualMachineInstancePropertiesStorageProfileOsDisk. + */ + public static VirtualMachineInstancePropertiesStorageProfileOsDisk fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstancePropertiesStorageProfileOsDisk deserializedVirtualMachineInstancePropertiesStorageProfileOsDisk + = new VirtualMachineInstancePropertiesStorageProfileOsDisk(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesStorageProfileOsDisk.id = reader.getString(); + } else if ("osType".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesStorageProfileOsDisk.osType + = OperatingSystemTypes.fromString(reader.getString()); + } else if ("managedDisk".equals(fieldName)) { + deserializedVirtualMachineInstancePropertiesStorageProfileOsDisk.managedDisk + = VirtualMachineInstanceManagedDiskParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstancePropertiesStorageProfileOsDisk; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceStatus.java new file mode 100644 index 000000000000..7a87d8ab64bc --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceStatus.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The observed state of virtual machine instances. + */ +@Immutable +public final class VirtualMachineInstanceStatus implements JsonSerializable { + /* + * VirtualMachine provisioning error code + */ + private String errorCode; + + /* + * Descriptive error message + */ + private String errorMessage; + + /* + * The power state of the virtual machine instance + */ + private PowerStateEnum powerState; + + /* + * Provisioning status of the virtual machine instance + */ + private VirtualMachineInstanceStatusProvisioningStatus provisioningStatus; + + /** + * Creates an instance of VirtualMachineInstanceStatus class. + */ + private VirtualMachineInstanceStatus() { + } + + /** + * Get the errorCode property: VirtualMachine provisioning error code. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Get the errorMessage property: Descriptive error message. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Get the powerState property: The power state of the virtual machine instance. + * + * @return the powerState value. + */ + public PowerStateEnum powerState() { + return this.powerState; + } + + /** + * Get the provisioningStatus property: Provisioning status of the virtual machine instance. + * + * @return the provisioningStatus value. + */ + public VirtualMachineInstanceStatusProvisioningStatus provisioningStatus() { + return this.provisioningStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provisioningStatus() != null) { + provisioningStatus().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("errorCode", this.errorCode); + jsonWriter.writeStringField("errorMessage", this.errorMessage); + jsonWriter.writeStringField("powerState", this.powerState == null ? null : this.powerState.toString()); + jsonWriter.writeJsonField("provisioningStatus", this.provisioningStatus); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstanceStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstanceStatus 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 VirtualMachineInstanceStatus. + */ + public static VirtualMachineInstanceStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstanceStatus deserializedVirtualMachineInstanceStatus = new VirtualMachineInstanceStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("errorCode".equals(fieldName)) { + deserializedVirtualMachineInstanceStatus.errorCode = reader.getString(); + } else if ("errorMessage".equals(fieldName)) { + deserializedVirtualMachineInstanceStatus.errorMessage = reader.getString(); + } else if ("powerState".equals(fieldName)) { + deserializedVirtualMachineInstanceStatus.powerState = PowerStateEnum.fromString(reader.getString()); + } else if ("provisioningStatus".equals(fieldName)) { + deserializedVirtualMachineInstanceStatus.provisioningStatus + = VirtualMachineInstanceStatusProvisioningStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstanceStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceStatusProvisioningStatus.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceStatusProvisioningStatus.java new file mode 100644 index 000000000000..13b26af37ba0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceStatusProvisioningStatus.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Virtual machine instance provisioning status. + */ +@Immutable +public final class VirtualMachineInstanceStatusProvisioningStatus + implements JsonSerializable { + /* + * The ID of the operation performed on the virtual machine instance + */ + private String operationId; + + /* + * The status of the operation performed on the virtual machine instance [Succeeded, Failed, InProgress] + */ + private Status status; + + /** + * Creates an instance of VirtualMachineInstanceStatusProvisioningStatus class. + */ + private VirtualMachineInstanceStatusProvisioningStatus() { + } + + /** + * Get the operationId property: The ID of the operation performed on the virtual machine instance. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the status property: The status of the operation performed on the virtual machine instance [Succeeded, + * Failed, InProgress]. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * 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("operationId", this.operationId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstanceStatusProvisioningStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstanceStatusProvisioningStatus 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 VirtualMachineInstanceStatusProvisioningStatus. + */ + public static VirtualMachineInstanceStatusProvisioningStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstanceStatusProvisioningStatus deserializedVirtualMachineInstanceStatusProvisioningStatus + = new VirtualMachineInstanceStatusProvisioningStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operationId".equals(fieldName)) { + deserializedVirtualMachineInstanceStatusProvisioningStatus.operationId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedVirtualMachineInstanceStatusProvisioningStatus.status + = Status.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstanceStatusProvisioningStatus; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceUpdateProperties.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceUpdateProperties.java new file mode 100644 index 000000000000..9f7458ea14a3 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceUpdateProperties.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * Defines the resource properties for the update. + */ +@Fluent +public final class VirtualMachineInstanceUpdateProperties + implements JsonSerializable { + /* + * HardwareProfile - Specifies the hardware settings for the virtual machine instance. + */ + private HardwareProfileUpdate hardwareProfile; + + /* + * StorageProfile - Specifies the storage settings for the virtual machine instance. + */ + private StorageProfileUpdate storageProfile; + + /* + * NetworkProfile - describes the network update configuration the virtual machine instance + */ + private NetworkProfileUpdate networkProfile; + + /* + * OsProfile - describes the update configuration of the operating system + */ + private OsProfileUpdate osProfile; + + /** + * Creates an instance of VirtualMachineInstanceUpdateProperties class. + */ + public VirtualMachineInstanceUpdateProperties() { + } + + /** + * Get the hardwareProfile property: HardwareProfile - Specifies the hardware settings for the virtual machine + * instance. + * + * @return the hardwareProfile value. + */ + public HardwareProfileUpdate hardwareProfile() { + return this.hardwareProfile; + } + + /** + * Set the hardwareProfile property: HardwareProfile - Specifies the hardware settings for the virtual machine + * instance. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the VirtualMachineInstanceUpdateProperties object itself. + */ + public VirtualMachineInstanceUpdateProperties withHardwareProfile(HardwareProfileUpdate hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Get the storageProfile property: StorageProfile - Specifies the storage settings for the virtual machine + * instance. + * + * @return the storageProfile value. + */ + public StorageProfileUpdate storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: StorageProfile - Specifies the storage settings for the virtual machine + * instance. + * + * @param storageProfile the storageProfile value to set. + * @return the VirtualMachineInstanceUpdateProperties object itself. + */ + public VirtualMachineInstanceUpdateProperties withStorageProfile(StorageProfileUpdate storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the networkProfile property: NetworkProfile - describes the network update configuration the virtual machine + * instance. + * + * @return the networkProfile value. + */ + public NetworkProfileUpdate networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: NetworkProfile - describes the network update configuration the virtual machine + * instance. + * + * @param networkProfile the networkProfile value to set. + * @return the VirtualMachineInstanceUpdateProperties object itself. + */ + public VirtualMachineInstanceUpdateProperties withNetworkProfile(NetworkProfileUpdate networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the osProfile property: OsProfile - describes the update configuration of the operating system. + * + * @return the osProfile value. + */ + public OsProfileUpdate osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: OsProfile - describes the update configuration of the operating system. + * + * @param osProfile the osProfile value to set. + * @return the VirtualMachineInstanceUpdateProperties object itself. + */ + public VirtualMachineInstanceUpdateProperties withOsProfile(OsProfileUpdate osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hardwareProfile() != null) { + hardwareProfile().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (osProfile() != null) { + osProfile().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("hardwareProfile", this.hardwareProfile); + jsonWriter.writeJsonField("storageProfile", this.storageProfile); + jsonWriter.writeJsonField("networkProfile", this.networkProfile); + jsonWriter.writeJsonField("osProfile", this.osProfile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstanceUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstanceUpdateProperties 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 VirtualMachineInstanceUpdateProperties. + */ + public static VirtualMachineInstanceUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstanceUpdateProperties deserializedVirtualMachineInstanceUpdateProperties + = new VirtualMachineInstanceUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("hardwareProfile".equals(fieldName)) { + deserializedVirtualMachineInstanceUpdateProperties.hardwareProfile + = HardwareProfileUpdate.fromJson(reader); + } else if ("storageProfile".equals(fieldName)) { + deserializedVirtualMachineInstanceUpdateProperties.storageProfile + = StorageProfileUpdate.fromJson(reader); + } else if ("networkProfile".equals(fieldName)) { + deserializedVirtualMachineInstanceUpdateProperties.networkProfile + = NetworkProfileUpdate.fromJson(reader); + } else if ("osProfile".equals(fieldName)) { + deserializedVirtualMachineInstanceUpdateProperties.osProfile = OsProfileUpdate.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstanceUpdateProperties; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceUpdateRequest.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceUpdateRequest.java new file mode 100644 index 000000000000..b282b7276310 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceUpdateRequest.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The virtual machine instance resource patch definition. + */ +@Fluent +public final class VirtualMachineInstanceUpdateRequest + implements JsonSerializable { + /* + * Defines the resource properties for the update. + */ + private VirtualMachineInstanceUpdateProperties properties; + + /* + * Identity for the resource. + */ + private Identity identity; + + /** + * Creates an instance of VirtualMachineInstanceUpdateRequest class. + */ + public VirtualMachineInstanceUpdateRequest() { + } + + /** + * Get the properties property: Defines the resource properties for the update. + * + * @return the properties value. + */ + public VirtualMachineInstanceUpdateProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Defines the resource properties for the update. + * + * @param properties the properties value to set. + * @return the VirtualMachineInstanceUpdateRequest object itself. + */ + public VirtualMachineInstanceUpdateRequest withProperties(VirtualMachineInstanceUpdateProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the VirtualMachineInstanceUpdateRequest object itself. + */ + public VirtualMachineInstanceUpdateRequest withIdentity(Identity 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.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstanceUpdateRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstanceUpdateRequest 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 VirtualMachineInstanceUpdateRequest. + */ + public static VirtualMachineInstanceUpdateRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstanceUpdateRequest deserializedVirtualMachineInstanceUpdateRequest + = new VirtualMachineInstanceUpdateRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedVirtualMachineInstanceUpdateRequest.properties + = VirtualMachineInstanceUpdateProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedVirtualMachineInstanceUpdateRequest.identity = Identity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstanceUpdateRequest; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceView.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceView.java new file mode 100644 index 000000000000..873dd8dbd993 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstanceView.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The instance view of a virtual machine. + */ +@Immutable +public final class VirtualMachineInstanceView implements JsonSerializable { + /* + * The VM Config Agent running on the virtual machine. + */ + private VirtualMachineConfigAgentInstanceView vmAgent; + + /** + * Creates an instance of VirtualMachineInstanceView class. + */ + private VirtualMachineInstanceView() { + } + + /** + * Get the vmAgent property: The VM Config Agent running on the virtual machine. + * + * @return the vmAgent value. + */ + public VirtualMachineConfigAgentInstanceView vmAgent() { + return this.vmAgent; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vmAgent() != null) { + vmAgent().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("vmAgent", this.vmAgent); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualMachineInstanceView from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualMachineInstanceView 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 VirtualMachineInstanceView. + */ + public static VirtualMachineInstanceView fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualMachineInstanceView deserializedVirtualMachineInstanceView = new VirtualMachineInstanceView(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("vmAgent".equals(fieldName)) { + deserializedVirtualMachineInstanceView.vmAgent + = VirtualMachineConfigAgentInstanceView.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualMachineInstanceView; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstances.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstances.java new file mode 100644 index 000000000000..beafd4df4786 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VirtualMachineInstances.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner; + +/** + * Resource collection API of VirtualMachineInstances. + */ +public interface VirtualMachineInstances { + /** + * Gets a virtual machine instance. + * + * @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 a virtual machine instance along with {@link Response}. + */ + Response getWithResponse(String resourceUri, Context context); + + /** + * Gets a virtual machine instance. + * + * @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 a virtual machine instance. + */ + VirtualMachineInstance get(String resourceUri); + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + VirtualMachineInstance createOrUpdate(String resourceUri, VirtualMachineInstanceInner resource); + + /** + * The operation to create or update a virtual machine instance. Please note some properties can be set only during + * virtual machine instance creation. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + VirtualMachineInstance createOrUpdate(String resourceUri, VirtualMachineInstanceInner resource, Context context); + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + VirtualMachineInstance update(String resourceUri, VirtualMachineInstanceUpdateRequest properties); + + /** + * The operation to update a virtual machine instance. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the 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 virtual machine instance resource definition. + */ + VirtualMachineInstance update(String resourceUri, VirtualMachineInstanceUpdateRequest properties, Context context); + + /** + * The operation to delete a virtual machine instance. + * + * @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. + */ + void delete(String resourceUri); + + /** + * The operation to delete a virtual machine instance. + * + * @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. + */ + void delete(String resourceUri, Context context); + + /** + * Lists all of the virtual machine instances within the specified parent resource. + * + * @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 VirtualMachineInstance list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * Lists all of the virtual machine instances within the specified parent resource. + * + * @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 VirtualMachineInstance list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, Context context); + + /** + * The operation to start a virtual machine instance. + * + * @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. + */ + void start(String resourceUri); + + /** + * The operation to start a virtual machine instance. + * + * @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. + */ + void start(String resourceUri, Context context); + + /** + * The operation to stop a virtual machine instance. + * + * @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. + */ + void stop(String resourceUri); + + /** + * The operation to stop a virtual machine instance. + * + * @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. + */ + void stop(String resourceUri, Context context); + + /** + * The operation to restart a virtual machine instance. + * + * @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. + */ + void restart(String resourceUri); + + /** + * The operation to restart a virtual machine instance. + * + * @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. + */ + void restart(String resourceUri, Context context); + + /** + * The operation to pause a virtual machine instance. + * + * @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. + */ + void pause(String resourceUri); + + /** + * The operation to pause a virtual machine instance. + * + * @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. + */ + void pause(String resourceUri, Context context); + + /** + * The operation to save a virtual machine instance. + * + * @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. + */ + void save(String resourceUri); + + /** + * The operation to save a virtual machine instance. + * + * @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. + */ + void save(String resourceUri, Context context); +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VmImageRepositoryCredentials.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VmImageRepositoryCredentials.java new file mode 100644 index 000000000000..a0b9ec1d8511 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VmImageRepositoryCredentials.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.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; + +/** + * The credentials used to login to the image repository that has access to the specified image. + */ +@Fluent +public final class VmImageRepositoryCredentials implements JsonSerializable { + /* + * Username for accessing image repository + */ + private String username; + + /* + * Password for accessing image repository + */ + private String password; + + /** + * Creates an instance of VmImageRepositoryCredentials class. + */ + public VmImageRepositoryCredentials() { + } + + /** + * Get the username property: Username for accessing image repository. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: Username for accessing image repository. + * + * @param username the username value to set. + * @return the VmImageRepositoryCredentials object itself. + */ + public VmImageRepositoryCredentials withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Password for accessing image repository. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Password for accessing image repository. + * + * @param password the password value to set. + * @return the VmImageRepositoryCredentials object itself. + */ + public VmImageRepositoryCredentials withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (username() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property username in model VmImageRepositoryCredentials")); + } + if (password() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property password in model VmImageRepositoryCredentials")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VmImageRepositoryCredentials.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("username", this.username); + jsonWriter.writeStringField("password", this.password); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VmImageRepositoryCredentials from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VmImageRepositoryCredentials 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 VmImageRepositoryCredentials. + */ + public static VmImageRepositoryCredentials fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VmImageRepositoryCredentials deserializedVmImageRepositoryCredentials = new VmImageRepositoryCredentials(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("username".equals(fieldName)) { + deserializedVmImageRepositoryCredentials.username = reader.getString(); + } else if ("password".equals(fieldName)) { + deserializedVmImageRepositoryCredentials.password = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVmImageRepositoryCredentials; + }); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VmSizeEnum.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VmSizeEnum.java new file mode 100644 index 000000000000..30e3a9ba54d2 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/VmSizeEnum.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * VM Sizes. + */ +public final class VmSizeEnum extends ExpandableStringEnum { + /** + * Default virtual machine size. + */ + public static final VmSizeEnum DEFAULT = fromString("Default"); + + /** + * Standard A2 v2 virtual machine size. + */ + public static final VmSizeEnum STANDARD_A2_V2 = fromString("Standard_A2_v2"); + + /** + * Standard A4 v2 virtual machine size. + */ + public static final VmSizeEnum STANDARD_A4_V2 = fromString("Standard_A4_v2"); + + /** + * Standard D2s v3 virtual machine size. + */ + public static final VmSizeEnum STANDARD_D2S_V3 = fromString("Standard_D2s_v3"); + + /** + * Standard D4s v3 virtual machine size. + */ + public static final VmSizeEnum STANDARD_D4S_V3 = fromString("Standard_D4s_v3"); + + /** + * Standard D8s v3 virtual machine size. + */ + public static final VmSizeEnum STANDARD_D8S_V3 = fromString("Standard_D8s_v3"); + + /** + * Standard D16s v3 virtual machine size. + */ + public static final VmSizeEnum STANDARD_D16S_V3 = fromString("Standard_D16s_v3"); + + /** + * Standard D32s v3 virtual machine size. + */ + public static final VmSizeEnum STANDARD_D32S_V3 = fromString("Standard_D32s_v3"); + + /** + * Standard DS2 v2 virtual machine size. + */ + public static final VmSizeEnum STANDARD_DS2_V2 = fromString("Standard_DS2_v2"); + + /** + * Standard DS3 v2 virtual machine size. + */ + public static final VmSizeEnum STANDARD_DS3_V2 = fromString("Standard_DS3_v2"); + + /** + * Standard DS4 v2 virtual machine size. + */ + public static final VmSizeEnum STANDARD_DS4_V2 = fromString("Standard_DS4_v2"); + + /** + * Standard DS5 v2 virtual machine size. + */ + public static final VmSizeEnum STANDARD_DS5_V2 = fromString("Standard_DS5_v2"); + + /** + * Standard DS13 v2 virtual machine size. + */ + public static final VmSizeEnum STANDARD_DS13_V2 = fromString("Standard_DS13_v2"); + + /** + * Standard K8S v1 virtual machine size. + */ + public static final VmSizeEnum STANDARD_K8S_V1 = fromString("Standard_K8S_v1"); + + /** + * Standard K8S2 v1 virtual machine size. + */ + public static final VmSizeEnum STANDARD_K8S2_V1 = fromString("Standard_K8S2_v1"); + + /** + * Standard K8S3 v1 virtual machine size. + */ + public static final VmSizeEnum STANDARD_K8S3_V1 = fromString("Standard_K8S3_v1"); + + /** + * Standard K8S4 v1 virtual machine size. + */ + public static final VmSizeEnum STANDARD_K8S4_V1 = fromString("Standard_K8S4_v1"); + + /** + * Standard NK6 virtual machine size. + */ + public static final VmSizeEnum STANDARD_NK6 = fromString("Standard_NK6"); + + /** + * Standard NK12 virtual machine size. + */ + public static final VmSizeEnum STANDARD_NK12 = fromString("Standard_NK12"); + + /** + * Standard NV6 virtual machine size. + */ + public static final VmSizeEnum STANDARD_NV6 = fromString("Standard_NV6"); + + /** + * Standard NV12 virtual machine size. + */ + public static final VmSizeEnum STANDARD_NV12 = fromString("Standard_NV12"); + + /** + * Standard K8S5 v1 virtual machine size. + */ + public static final VmSizeEnum STANDARD_K8S5_V1 = fromString("Standard_K8S5_v1"); + + /** + * Custom virtual machine size. + */ + public static final VmSizeEnum CUSTOM = fromString("Custom"); + + /** + * Creates a new instance of VmSizeEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public VmSizeEnum() { + } + + /** + * Creates or finds a VmSizeEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding VmSizeEnum. + */ + public static VmSizeEnum fromString(String name) { + return fromString(name, VmSizeEnum.class); + } + + /** + * Gets known VmSizeEnum values. + * + * @return known VmSizeEnum values. + */ + public static Collection values() { + return values(VmSizeEnum.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/package-info.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/package-info.java new file mode 100644 index 000000000000..d8403edf0d55 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for AzureStackHciVm. + * Azure Stack HCI management service. + */ +package com.azure.resourcemanager.azurestackhci.vm.models; diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/package-info.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/package-info.java new file mode 100644 index 000000000000..44a00f681405 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/com/azure/resourcemanager/azurestackhci/vm/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for AzureStackHciVm. + * Azure Stack HCI management service. + */ +package com.azure.resourcemanager.azurestackhci.vm; diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/module-info.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/module-info.java new file mode 100644 index 000000000000..ca5106420adf --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.azurestackhci.vm { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.azurestackhci.vm; + exports com.azure.resourcemanager.azurestackhci.vm.fluent; + exports com.azure.resourcemanager.azurestackhci.vm.fluent.models; + exports com.azure.resourcemanager.azurestackhci.vm.models; + + opens com.azure.resourcemanager.azurestackhci.vm.fluent.models to com.azure.core; + opens com.azure.resourcemanager.azurestackhci.vm.models to com.azure.core; + opens com.azure.resourcemanager.azurestackhci.vm.implementation.models to com.azure.core; +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/azure-resourcemanager-azurestackhci-vm_apiview_properties.json b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/azure-resourcemanager-azurestackhci-vm_apiview_properties.json new file mode 100644 index 000000000000..d3b386b0b31b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/azure-resourcemanager-azurestackhci-vm_apiview_properties.json @@ -0,0 +1,282 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.resourcemanager.azurestackhci.vm.fluent.AttestationStatusesClient": "Microsoft.AzureStackHCI.AttestationStatuses", + "com.azure.resourcemanager.azurestackhci.vm.fluent.AttestationStatusesClient.get": "Microsoft.AzureStackHCI.AttestationStatuses.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.AttestationStatusesClient.getWithResponse": "Microsoft.AzureStackHCI.AttestationStatuses.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.AzureStackHciVmMgmtClient": "Microsoft.AzureStackHCI", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient": "Microsoft.AzureStackHCI.GalleryImages", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.beginCreateOrUpdate": "Microsoft.AzureStackHCI.GalleryImages.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.beginDelete": "Microsoft.AzureStackHCI.GalleryImages.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.beginUpdate": "Microsoft.AzureStackHCI.GalleryImages.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.createOrUpdate": "Microsoft.AzureStackHCI.GalleryImages.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.delete": "Microsoft.AzureStackHCI.GalleryImages.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.getByResourceGroup": "Microsoft.AzureStackHCI.GalleryImages.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.getByResourceGroupWithResponse": "Microsoft.AzureStackHCI.GalleryImages.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.list": "Microsoft.AzureStackHCI.GalleryImages.listAll", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.listByResourceGroup": "Microsoft.AzureStackHCI.GalleryImages.listByResourceGroup", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.update": "Microsoft.AzureStackHCI.GalleryImages.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient": "Microsoft.AzureStackHCI.GuestAgents", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.beginCreate": "Microsoft.AzureStackHCI.GuestAgents.create", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.beginDelete": "Microsoft.AzureStackHCI.GuestAgents.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.create": "Microsoft.AzureStackHCI.GuestAgents.create", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.delete": "Microsoft.AzureStackHCI.GuestAgents.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.get": "Microsoft.AzureStackHCI.GuestAgents.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.getWithResponse": "Microsoft.AzureStackHCI.GuestAgents.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.listByVirtualMachineInstance": "Microsoft.AzureStackHCI.GuestAgents.listByVirtualMachineInstance", + "com.azure.resourcemanager.azurestackhci.vm.fluent.HybridIdentityMetadatasClient": "Microsoft.AzureStackHCI.HybridIdentityMetadataGroup", + "com.azure.resourcemanager.azurestackhci.vm.fluent.HybridIdentityMetadatasClient.get": "Microsoft.AzureStackHCI.HybridIdentityMetadataGroup.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.HybridIdentityMetadatasClient.getWithResponse": "Microsoft.AzureStackHCI.HybridIdentityMetadataGroup.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.HybridIdentityMetadatasClient.listByVirtualMachineInstance": "Microsoft.AzureStackHCI.HybridIdentityMetadataGroup.listByVirtualMachineInstance", + "com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient": "Microsoft.AzureStackHCI.LogicalNetworks", + "com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.beginCreateOrUpdate": "Microsoft.AzureStackHCI.LogicalNetworks.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.beginDelete": "Microsoft.AzureStackHCI.LogicalNetworks.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.beginUpdate": "Microsoft.AzureStackHCI.LogicalNetworks.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.createOrUpdate": "Microsoft.AzureStackHCI.LogicalNetworks.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.delete": "Microsoft.AzureStackHCI.LogicalNetworks.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.getByResourceGroup": "Microsoft.AzureStackHCI.LogicalNetworks.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.getByResourceGroupWithResponse": "Microsoft.AzureStackHCI.LogicalNetworks.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.list": "Microsoft.AzureStackHCI.LogicalNetworks.listAll", + "com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.listByResourceGroup": "Microsoft.AzureStackHCI.LogicalNetworks.listByResourceGroup", + "com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.update": "Microsoft.AzureStackHCI.LogicalNetworks.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient": "Microsoft.AzureStackHCI.MarketplaceGalleryImages", + "com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.beginCreateOrUpdate": "Microsoft.AzureStackHCI.MarketplaceGalleryImages.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.beginDelete": "Microsoft.AzureStackHCI.MarketplaceGalleryImages.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.beginUpdate": "Microsoft.AzureStackHCI.MarketplaceGalleryImages.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.createOrUpdate": "Microsoft.AzureStackHCI.MarketplaceGalleryImages.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.delete": "Microsoft.AzureStackHCI.MarketplaceGalleryImages.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.getByResourceGroup": "Microsoft.AzureStackHCI.MarketplaceGalleryImages.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.getByResourceGroupWithResponse": "Microsoft.AzureStackHCI.MarketplaceGalleryImages.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.list": "Microsoft.AzureStackHCI.MarketplaceGalleryImages.listAll", + "com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.listByResourceGroup": "Microsoft.AzureStackHCI.MarketplaceGalleryImages.listByResourceGroup", + "com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.update": "Microsoft.AzureStackHCI.MarketplaceGalleryImages.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient": "Microsoft.AzureStackHCI.NetworkInterfaces", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.beginCreateOrUpdate": "Microsoft.AzureStackHCI.NetworkInterfaces.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.beginDelete": "Microsoft.AzureStackHCI.NetworkInterfaces.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.beginUpdate": "Microsoft.AzureStackHCI.NetworkInterfaces.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.createOrUpdate": "Microsoft.AzureStackHCI.NetworkInterfaces.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.delete": "Microsoft.AzureStackHCI.NetworkInterfaces.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.getByResourceGroup": "Microsoft.AzureStackHCI.NetworkInterfaces.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.getByResourceGroupWithResponse": "Microsoft.AzureStackHCI.NetworkInterfaces.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.list": "Microsoft.AzureStackHCI.NetworkInterfaces.listAll", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.listByResourceGroup": "Microsoft.AzureStackHCI.NetworkInterfaces.listByResourceGroup", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.update": "Microsoft.AzureStackHCI.NetworkInterfaces.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient": "Microsoft.AzureStackHCI.NetworkSecurityGroups", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.beginCreateOrUpdate": "Microsoft.AzureStackHCI.NetworkSecurityGroups.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.beginDelete": "Microsoft.AzureStackHCI.NetworkSecurityGroups.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.beginUpdateTags": "Microsoft.AzureStackHCI.NetworkSecurityGroups.updateTags", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.createOrUpdate": "Microsoft.AzureStackHCI.NetworkSecurityGroups.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.delete": "Microsoft.AzureStackHCI.NetworkSecurityGroups.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.getByResourceGroup": "Microsoft.AzureStackHCI.NetworkSecurityGroups.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.getByResourceGroupWithResponse": "Microsoft.AzureStackHCI.NetworkSecurityGroups.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.list": "Microsoft.AzureStackHCI.NetworkSecurityGroups.listAll", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.listByResourceGroup": "Microsoft.AzureStackHCI.NetworkSecurityGroups.listByResourceGroup", + "com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.updateTags": "Microsoft.AzureStackHCI.NetworkSecurityGroups.updateTags", + "com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient": "Microsoft.AzureStackHCI.SecurityRules", + "com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.beginCreateOrUpdate": "Microsoft.AzureStackHCI.SecurityRules.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.beginDelete": "Microsoft.AzureStackHCI.SecurityRules.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.createOrUpdate": "Microsoft.AzureStackHCI.SecurityRules.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.delete": "Microsoft.AzureStackHCI.SecurityRules.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.get": "Microsoft.AzureStackHCI.SecurityRules.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.getWithResponse": "Microsoft.AzureStackHCI.SecurityRules.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.listByNetworkSecurityGroup": "Microsoft.AzureStackHCI.SecurityRules.listByNetworkSecurityGroup", + "com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient": "Microsoft.AzureStackHCI.StorageContainers", + "com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.beginCreateOrUpdate": "Microsoft.AzureStackHCI.StorageContainers.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.beginDelete": "Microsoft.AzureStackHCI.StorageContainers.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.beginUpdate": "Microsoft.AzureStackHCI.StorageContainers.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.createOrUpdate": "Microsoft.AzureStackHCI.StorageContainers.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.delete": "Microsoft.AzureStackHCI.StorageContainers.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.getByResourceGroup": "Microsoft.AzureStackHCI.StorageContainers.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.getByResourceGroupWithResponse": "Microsoft.AzureStackHCI.StorageContainers.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.list": "Microsoft.AzureStackHCI.StorageContainers.listAll", + "com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.listByResourceGroup": "Microsoft.AzureStackHCI.StorageContainers.listByResourceGroup", + "com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.update": "Microsoft.AzureStackHCI.StorageContainers.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient": "Microsoft.AzureStackHCI.VirtualHardDisks", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.beginCreateOrUpdate": "Microsoft.AzureStackHCI.VirtualHardDisks.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.beginDelete": "Microsoft.AzureStackHCI.VirtualHardDisks.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.beginUpdate": "Microsoft.AzureStackHCI.VirtualHardDisks.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.beginUpload": "Microsoft.AzureStackHCI.VirtualHardDisks.upload", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.createOrUpdate": "Microsoft.AzureStackHCI.VirtualHardDisks.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.delete": "Microsoft.AzureStackHCI.VirtualHardDisks.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.getByResourceGroup": "Microsoft.AzureStackHCI.VirtualHardDisks.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.getByResourceGroupWithResponse": "Microsoft.AzureStackHCI.VirtualHardDisks.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.list": "Microsoft.AzureStackHCI.VirtualHardDisks.listAll", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.listByResourceGroup": "Microsoft.AzureStackHCI.VirtualHardDisks.listByResourceGroup", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.update": "Microsoft.AzureStackHCI.VirtualHardDisks.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.upload": "Microsoft.AzureStackHCI.VirtualHardDisks.upload", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient": "Microsoft.AzureStackHCI.VirtualMachineInstances", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginCreateOrUpdate": "Microsoft.AzureStackHCI.VirtualMachineInstances.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginDelete": "Microsoft.AzureStackHCI.VirtualMachineInstances.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginPause": "Microsoft.AzureStackHCI.VirtualMachineInstances.pause", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginRestart": "Microsoft.AzureStackHCI.VirtualMachineInstances.restart", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginSave": "Microsoft.AzureStackHCI.VirtualMachineInstances.save", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginStart": "Microsoft.AzureStackHCI.VirtualMachineInstances.start", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginStop": "Microsoft.AzureStackHCI.VirtualMachineInstances.stop", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginUpdate": "Microsoft.AzureStackHCI.VirtualMachineInstances.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.createOrUpdate": "Microsoft.AzureStackHCI.VirtualMachineInstances.createOrUpdate", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.delete": "Microsoft.AzureStackHCI.VirtualMachineInstances.delete", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.get": "Microsoft.AzureStackHCI.VirtualMachineInstances.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.getWithResponse": "Microsoft.AzureStackHCI.VirtualMachineInstances.get", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.list": "Microsoft.AzureStackHCI.VirtualMachineInstances.list", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.pause": "Microsoft.AzureStackHCI.VirtualMachineInstances.pause", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.restart": "Microsoft.AzureStackHCI.VirtualMachineInstances.restart", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.save": "Microsoft.AzureStackHCI.VirtualMachineInstances.save", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.start": "Microsoft.AzureStackHCI.VirtualMachineInstances.start", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.stop": "Microsoft.AzureStackHCI.VirtualMachineInstances.stop", + "com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.update": "Microsoft.AzureStackHCI.VirtualMachineInstances.update", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.AttestationStatusInner": "Microsoft.AzureStackHCI.AttestationStatus", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.GalleryImageInner": "Microsoft.AzureStackHCI.GalleryImage", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.GalleryImageVersionProperties": "Microsoft.AzureStackHCI.GalleryImageVersionProperties", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.GuestAgentInner": "Microsoft.AzureStackHCI.GuestAgent", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.HybridIdentityMetadataInner": "Microsoft.AzureStackHCI.HybridIdentityMetadata", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.LogicalNetworkInner": "Microsoft.AzureStackHCI.LogicalNetwork", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.MarketplaceGalleryImageInner": "Microsoft.AzureStackHCI.MarketplaceGalleryImage", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkInterfaceInner": "Microsoft.AzureStackHCI.NetworkInterface", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkSecurityGroupInner": "Microsoft.AzureStackHCI.NetworkSecurityGroup", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.RouteProperties": "Microsoft.AzureStackHCI.RouteProperties", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.RouteTableProperties": "Microsoft.AzureStackHCI.RouteTableProperties", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.SecurityRuleInner": "Microsoft.AzureStackHCI.SecurityRule", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.StorageContainerInner": "Microsoft.AzureStackHCI.StorageContainer", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.SubnetProperties": "Microsoft.AzureStackHCI.SubnetProperties", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskInner": "Microsoft.AzureStackHCI.VirtualHardDisk", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskUploadResponseInner": "Microsoft.AzureStackHCI.VirtualHardDiskUploadResponse", + "com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner": "Microsoft.AzureStackHCI.VirtualMachineInstance", + "com.azure.resourcemanager.azurestackhci.vm.implementation.AzureStackHciVmMgmtClientBuilder": "Microsoft.AzureStackHCI", + "com.azure.resourcemanager.azurestackhci.vm.implementation.models.GalleryImageListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.azurestackhci.vm.implementation.models.GuestAgentListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.azurestackhci.vm.implementation.models.HybridIdentityMetadataListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.azurestackhci.vm.implementation.models.LogicalNetworkListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.azurestackhci.vm.implementation.models.MarketplaceGalleryImageListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.azurestackhci.vm.implementation.models.NetworkInterfaceListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.azurestackhci.vm.implementation.models.NetworkSecurityGroupListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.azurestackhci.vm.implementation.models.SecurityRuleListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.azurestackhci.vm.implementation.models.StorageContainerListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.azurestackhci.vm.implementation.models.VirtualHardDiskListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.azurestackhci.vm.implementation.models.VirtualMachineInstanceListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.azurestackhci.vm.models.AttestBootIntegrityPropertyEnum": "Microsoft.AzureStackHCI.AttestBootIntegrityPropertyEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.AttestCertPropertyEnum": "Microsoft.AzureStackHCI.AttestCertPropertyEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.AttestDiskSecurityEncryptionTypeEnum": "Microsoft.AzureStackHCI.AttestDiskSecurityEncryptionTypeEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.AttestHWPlatformEnum": "Microsoft.AzureStackHCI.AttestHWPlatformEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.AttestHealthStatusEnum": "Microsoft.AzureStackHCI.AttestHealthStatusEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.AttestSecureBootPropertyEnum": "Microsoft.AzureStackHCI.AttestSecureBootPropertyEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.AttestationStatusProperties": "Microsoft.AzureStackHCI.AttestationStatusProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.CloudInitDataSource": "Microsoft.AzureStackHCI.CloudInitDataSource", + "com.azure.resourcemanager.azurestackhci.vm.models.DiskFileFormat": "Microsoft.AzureStackHCI.DiskFileFormat", + "com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation": "Microsoft.AzureStackHCI.ExtendedLocation", + "com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes": "Microsoft.AzureStackHCI.ExtendedLocationTypes", + "com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageIdentifier": "Microsoft.AzureStackHCI.GalleryImageIdentifier", + "com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageProperties": "Microsoft.AzureStackHCI.GalleryImageProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageStatus": "Microsoft.AzureStackHCI.GalleryImageStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageStatusDownloadStatus": "Microsoft.AzureStackHCI.GalleryImageStatusDownloadStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageStatusProvisioningStatus": "Microsoft.AzureStackHCI.GalleryImageStatusProvisioningStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageTagsUpdate": "Azure.ResourceManager.Foundations.TagsUpdateModel", + "com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageVersion": "Microsoft.AzureStackHCI.GalleryImageVersion", + "com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageVersionStorageProfile": "Microsoft.AzureStackHCI.GalleryImageVersionStorageProfile", + "com.azure.resourcemanager.azurestackhci.vm.models.GalleryOSDiskImage": "Microsoft.AzureStackHCI.GalleryOSDiskImage", + "com.azure.resourcemanager.azurestackhci.vm.models.GpuAssignmentTypeEnum": "Microsoft.AzureStackHCI.GpuAssignmentTypeEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.GuestAgentInstallStatus": "Microsoft.AzureStackHCI.GuestAgentInstallStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.GuestAgentProperties": "Microsoft.AzureStackHCI.GuestAgentProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.GuestCredential": "Microsoft.AzureStackHCI.GuestCredential", + "com.azure.resourcemanager.azurestackhci.vm.models.HardwareProfileUpdate": "Microsoft.AzureStackHCI.HardwareProfileUpdate", + "com.azure.resourcemanager.azurestackhci.vm.models.HttpProxyConfiguration": "Microsoft.AzureStackHCI.HttpProxyConfiguration", + "com.azure.resourcemanager.azurestackhci.vm.models.HybridIdentityMetadataProperties": "Microsoft.AzureStackHCI.HybridIdentityMetadataProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.HyperVGeneration": "Microsoft.AzureStackHCI.HyperVGeneration", + "com.azure.resourcemanager.azurestackhci.vm.models.IPConfiguration": "Microsoft.AzureStackHCI.IPConfiguration", + "com.azure.resourcemanager.azurestackhci.vm.models.IPConfigurationProperties": "Microsoft.AzureStackHCI.IPConfigurationProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.IPPool": "Microsoft.AzureStackHCI.IPPool", + "com.azure.resourcemanager.azurestackhci.vm.models.IPPoolInfo": "Microsoft.AzureStackHCI.IPPoolInfo", + "com.azure.resourcemanager.azurestackhci.vm.models.IPPoolTypeEnum": "Microsoft.AzureStackHCI.IPPoolTypeEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.Identity": "Microsoft.AzureStackHCI.Identity", + "com.azure.resourcemanager.azurestackhci.vm.models.IdentityType": null, + "com.azure.resourcemanager.azurestackhci.vm.models.ImageArmReference": "Microsoft.AzureStackHCI.ImageArmReference", + "com.azure.resourcemanager.azurestackhci.vm.models.InstanceViewStatus": "Microsoft.AzureStackHCI.InstanceViewStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.InterfaceDNSSettings": "Microsoft.AzureStackHCI.InterfaceDNSSettings", + "com.azure.resourcemanager.azurestackhci.vm.models.IpAllocationMethodEnum": "Microsoft.AzureStackHCI.IpAllocationMethodEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkArmReference": "Microsoft.AzureStackHCI.LogicalNetworkArmReference", + "com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkProperties": "Microsoft.AzureStackHCI.LogicalNetworkProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkPropertiesDhcpOptions": "Microsoft.AzureStackHCI.LogicalNetworkPropertiesDhcpOptions", + "com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkStatus": "Microsoft.AzureStackHCI.LogicalNetworkStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkStatusProvisioningStatus": "Microsoft.AzureStackHCI.LogicalNetworkStatusProvisioningStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkTypeEnum": "Microsoft.AzureStackHCI.LogicalNetworkTypeEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworksUpdateRequest": "Microsoft.AzureStackHCI.LogicalNetworksUpdateRequest", + "com.azure.resourcemanager.azurestackhci.vm.models.ManagedServiceIdentity": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentity", + "com.azure.resourcemanager.azurestackhci.vm.models.ManagedServiceIdentityType": "Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType", + "com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageProperties": "Microsoft.AzureStackHCI.MarketplaceGalleryImageProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageStatus": "Microsoft.AzureStackHCI.MarketplaceGalleryImageStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageStatusDownloadStatus": "Microsoft.AzureStackHCI.MarketplaceGalleryImageStatusDownloadStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageStatusProvisioningStatus": "Microsoft.AzureStackHCI.MarketplaceGalleryImageStatusProvisioningStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageTagsUpdate": "Azure.ResourceManager.Foundations.TagsUpdateModel", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceArmReference": "Microsoft.AzureStackHCI.NetworkInterfaceArmReference", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceProperties": "Microsoft.AzureStackHCI.NetworkInterfaceProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceStatus": "Microsoft.AzureStackHCI.NetworkInterfaceStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceStatusProvisioningStatus": "Microsoft.AzureStackHCI.NetworkInterfaceStatusProvisioningStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfacesUpdateProperties": "Microsoft.AzureStackHCI.NetworkInterfacesUpdateProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfacesUpdateRequest": "Microsoft.AzureStackHCI.NetworkInterfacesUpdateRequest", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkProfileUpdate": "Microsoft.AzureStackHCI.NetworkProfileUpdate", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupArmReference": "Microsoft.AzureStackHCI.NetworkSecurityGroupArmReference", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupProperties": "Microsoft.AzureStackHCI.NetworkSecurityGroupProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupStatus": "Microsoft.AzureStackHCI.NetworkSecurityGroupStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupStatusProvisioningStatus": "Microsoft.AzureStackHCI.NetworkSecurityGroupStatusProvisioningStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupTagsUpdate": "Azure.ResourceManager.Foundations.TagsUpdateModel", + "com.azure.resourcemanager.azurestackhci.vm.models.OperatingSystemTypes": "Microsoft.AzureStackHCI.OperatingSystemTypes", + "com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdate": "Microsoft.AzureStackHCI.OsProfileUpdate", + "com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateLinuxConfiguration": "Microsoft.AzureStackHCI.OsProfileUpdateLinuxConfiguration", + "com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateWindowsConfiguration": "Microsoft.AzureStackHCI.OsProfileUpdateWindowsConfiguration", + "com.azure.resourcemanager.azurestackhci.vm.models.PowerStateEnum": "Microsoft.AzureStackHCI.PowerStateEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.ProvisioningAction": "Microsoft.AzureStackHCI.ProvisioningAction", + "com.azure.resourcemanager.azurestackhci.vm.models.ProvisioningStateEnum": "Microsoft.AzureStackHCI.ProvisioningStateEnum", + "com.azure.resourcemanager.azurestackhci.vm.models.Route": "Microsoft.AzureStackHCI.Route", + "com.azure.resourcemanager.azurestackhci.vm.models.RouteTable": "Microsoft.AzureStackHCI.RouteTable", + "com.azure.resourcemanager.azurestackhci.vm.models.SecurityEncryptionType": "Microsoft.AzureStackHCI.SecurityEncryptionType", + "com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleAccess": "Microsoft.AzureStackHCI.SecurityRuleAccess", + "com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleDirection": "Microsoft.AzureStackHCI.SecurityRuleDirection", + "com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProperties": "Microsoft.AzureStackHCI.SecurityRuleProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProtocol": "Microsoft.AzureStackHCI.SecurityRuleProtocol", + "com.azure.resourcemanager.azurestackhci.vm.models.SecurityTypes": "Microsoft.AzureStackHCI.SecurityTypes", + "com.azure.resourcemanager.azurestackhci.vm.models.SshConfiguration": "Microsoft.AzureStackHCI.SshConfiguration", + "com.azure.resourcemanager.azurestackhci.vm.models.SshPublicKey": "Microsoft.AzureStackHCI.SshPublicKey", + "com.azure.resourcemanager.azurestackhci.vm.models.Status": "Microsoft.AzureStackHCI.Status", + "com.azure.resourcemanager.azurestackhci.vm.models.StatusLevelTypes": "Microsoft.AzureStackHCI.StatusLevelTypes", + "com.azure.resourcemanager.azurestackhci.vm.models.StatusTypes": "Microsoft.AzureStackHCI.StatusTypes", + "com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerProperties": "Microsoft.AzureStackHCI.StorageContainerProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerStatus": "Microsoft.AzureStackHCI.StorageContainerStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerStatusProvisioningStatus": "Microsoft.AzureStackHCI.StorageContainerStatusProvisioningStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerTagsUpdate": "Azure.ResourceManager.Foundations.TagsUpdateModel", + "com.azure.resourcemanager.azurestackhci.vm.models.StorageProfileUpdate": "Microsoft.AzureStackHCI.StorageProfileUpdate", + "com.azure.resourcemanager.azurestackhci.vm.models.Subnet": "Microsoft.AzureStackHCI.Subnet", + "com.azure.resourcemanager.azurestackhci.vm.models.SubnetIpConfigurationReference": "Microsoft.AzureStackHCI.SubnetIpConfigurationReference", + "com.azure.resourcemanager.azurestackhci.vm.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "com.azure.resourcemanager.azurestackhci.vm.models.VMDiskSecurityProfile": "Microsoft.AzureStackHCI.VMDiskSecurityProfile", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskArmReference": "Microsoft.AzureStackHCI.VirtualHardDiskArmReference", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskDownloadStatus": "Microsoft.AzureStackHCI.VirtualHardDiskDownloadStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskProperties": "Microsoft.AzureStackHCI.VirtualHardDiskProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskStatus": "Microsoft.AzureStackHCI.VirtualHardDiskStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskStatusProvisioningStatus": "Microsoft.AzureStackHCI.VirtualHardDiskStatusProvisioningStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadRequest": "Microsoft.AzureStackHCI.VirtualHardDiskUploadRequest", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadStatus": "Microsoft.AzureStackHCI.VirtualHardDiskUploadStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisksUpdateProperties": "Microsoft.AzureStackHCI.VirtualHardDisksUpdateProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisksUpdateRequest": "Microsoft.AzureStackHCI.VirtualHardDisksUpdateRequest", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineConfigAgentInstanceView": "Microsoft.AzureStackHCI.VirtualMachineConfigAgentInstanceView", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceManagedDiskParameters": "Microsoft.AzureStackHCI.VirtualMachineInstanceManagedDiskParameters", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceProperties": "Microsoft.AzureStackHCI.VirtualMachineInstanceProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfile": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesHardwareProfile", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesNetworkProfile": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesNetworkProfile", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesOsProfile": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesOsProfile", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesOsProfileLinuxConfiguration": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesOsProfileLinuxConfiguration", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesPlacementProfile": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesPlacementProfile", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesSecurityProfile": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesSecurityProfile", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesSecurityProfileUefiSettings": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesSecurityProfileUefiSettings", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesStorageProfile": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesStorageProfile", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesStorageProfileOsDisk": "Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesStorageProfileOsDisk", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceStatus": "Microsoft.AzureStackHCI.VirtualMachineInstanceStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceStatusProvisioningStatus": "Microsoft.AzureStackHCI.VirtualMachineInstanceStatusProvisioningStatus", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateProperties": "Microsoft.AzureStackHCI.VirtualMachineInstanceUpdateProperties", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateRequest": "Microsoft.AzureStackHCI.VirtualMachineInstanceUpdateRequest", + "com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceView": "Microsoft.AzureStackHCI.VirtualMachineInstanceView", + "com.azure.resourcemanager.azurestackhci.vm.models.VmImageRepositoryCredentials": "Microsoft.AzureStackHCI.VmImageRepositoryCredentials", + "com.azure.resourcemanager.azurestackhci.vm.models.VmSizeEnum": "Microsoft.AzureStackHCI.VmSizeEnum" + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/azure-resourcemanager-azurestackhci-vm_metadata.json b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/azure-resourcemanager-azurestackhci-vm_metadata.json new file mode 100644 index 000000000000..8f0ba0978968 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/azure-resourcemanager-azurestackhci-vm_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersion":"2025-06-01-preview","crossLanguageDefinitions":{"com.azure.resourcemanager.azurestackhci.vm.fluent.AttestationStatusesClient":"Microsoft.AzureStackHCI.AttestationStatuses","com.azure.resourcemanager.azurestackhci.vm.fluent.AttestationStatusesClient.get":"Microsoft.AzureStackHCI.AttestationStatuses.get","com.azure.resourcemanager.azurestackhci.vm.fluent.AttestationStatusesClient.getWithResponse":"Microsoft.AzureStackHCI.AttestationStatuses.get","com.azure.resourcemanager.azurestackhci.vm.fluent.AzureStackHciVmMgmtClient":"Microsoft.AzureStackHCI","com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient":"Microsoft.AzureStackHCI.GalleryImages","com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.beginCreateOrUpdate":"Microsoft.AzureStackHCI.GalleryImages.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.beginDelete":"Microsoft.AzureStackHCI.GalleryImages.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.beginUpdate":"Microsoft.AzureStackHCI.GalleryImages.update","com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.createOrUpdate":"Microsoft.AzureStackHCI.GalleryImages.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.delete":"Microsoft.AzureStackHCI.GalleryImages.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.getByResourceGroup":"Microsoft.AzureStackHCI.GalleryImages.get","com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.getByResourceGroupWithResponse":"Microsoft.AzureStackHCI.GalleryImages.get","com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.list":"Microsoft.AzureStackHCI.GalleryImages.listAll","com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.listByResourceGroup":"Microsoft.AzureStackHCI.GalleryImages.listByResourceGroup","com.azure.resourcemanager.azurestackhci.vm.fluent.GalleryImagesClient.update":"Microsoft.AzureStackHCI.GalleryImages.update","com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient":"Microsoft.AzureStackHCI.GuestAgents","com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.beginCreate":"Microsoft.AzureStackHCI.GuestAgents.create","com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.beginDelete":"Microsoft.AzureStackHCI.GuestAgents.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.create":"Microsoft.AzureStackHCI.GuestAgents.create","com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.delete":"Microsoft.AzureStackHCI.GuestAgents.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.get":"Microsoft.AzureStackHCI.GuestAgents.get","com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.getWithResponse":"Microsoft.AzureStackHCI.GuestAgents.get","com.azure.resourcemanager.azurestackhci.vm.fluent.GuestAgentsClient.listByVirtualMachineInstance":"Microsoft.AzureStackHCI.GuestAgents.listByVirtualMachineInstance","com.azure.resourcemanager.azurestackhci.vm.fluent.HybridIdentityMetadatasClient":"Microsoft.AzureStackHCI.HybridIdentityMetadataGroup","com.azure.resourcemanager.azurestackhci.vm.fluent.HybridIdentityMetadatasClient.get":"Microsoft.AzureStackHCI.HybridIdentityMetadataGroup.get","com.azure.resourcemanager.azurestackhci.vm.fluent.HybridIdentityMetadatasClient.getWithResponse":"Microsoft.AzureStackHCI.HybridIdentityMetadataGroup.get","com.azure.resourcemanager.azurestackhci.vm.fluent.HybridIdentityMetadatasClient.listByVirtualMachineInstance":"Microsoft.AzureStackHCI.HybridIdentityMetadataGroup.listByVirtualMachineInstance","com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient":"Microsoft.AzureStackHCI.LogicalNetworks","com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.beginCreateOrUpdate":"Microsoft.AzureStackHCI.LogicalNetworks.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.beginDelete":"Microsoft.AzureStackHCI.LogicalNetworks.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.beginUpdate":"Microsoft.AzureStackHCI.LogicalNetworks.update","com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.createOrUpdate":"Microsoft.AzureStackHCI.LogicalNetworks.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.delete":"Microsoft.AzureStackHCI.LogicalNetworks.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.getByResourceGroup":"Microsoft.AzureStackHCI.LogicalNetworks.get","com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.getByResourceGroupWithResponse":"Microsoft.AzureStackHCI.LogicalNetworks.get","com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.list":"Microsoft.AzureStackHCI.LogicalNetworks.listAll","com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.listByResourceGroup":"Microsoft.AzureStackHCI.LogicalNetworks.listByResourceGroup","com.azure.resourcemanager.azurestackhci.vm.fluent.LogicalNetworksClient.update":"Microsoft.AzureStackHCI.LogicalNetworks.update","com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient":"Microsoft.AzureStackHCI.MarketplaceGalleryImages","com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.beginCreateOrUpdate":"Microsoft.AzureStackHCI.MarketplaceGalleryImages.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.beginDelete":"Microsoft.AzureStackHCI.MarketplaceGalleryImages.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.beginUpdate":"Microsoft.AzureStackHCI.MarketplaceGalleryImages.update","com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.createOrUpdate":"Microsoft.AzureStackHCI.MarketplaceGalleryImages.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.delete":"Microsoft.AzureStackHCI.MarketplaceGalleryImages.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.getByResourceGroup":"Microsoft.AzureStackHCI.MarketplaceGalleryImages.get","com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.getByResourceGroupWithResponse":"Microsoft.AzureStackHCI.MarketplaceGalleryImages.get","com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.list":"Microsoft.AzureStackHCI.MarketplaceGalleryImages.listAll","com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.listByResourceGroup":"Microsoft.AzureStackHCI.MarketplaceGalleryImages.listByResourceGroup","com.azure.resourcemanager.azurestackhci.vm.fluent.MarketplaceGalleryImagesClient.update":"Microsoft.AzureStackHCI.MarketplaceGalleryImages.update","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient":"Microsoft.AzureStackHCI.NetworkInterfaces","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.beginCreateOrUpdate":"Microsoft.AzureStackHCI.NetworkInterfaces.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.beginDelete":"Microsoft.AzureStackHCI.NetworkInterfaces.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.beginUpdate":"Microsoft.AzureStackHCI.NetworkInterfaces.update","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.createOrUpdate":"Microsoft.AzureStackHCI.NetworkInterfaces.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.delete":"Microsoft.AzureStackHCI.NetworkInterfaces.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.getByResourceGroup":"Microsoft.AzureStackHCI.NetworkInterfaces.get","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.getByResourceGroupWithResponse":"Microsoft.AzureStackHCI.NetworkInterfaces.get","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.list":"Microsoft.AzureStackHCI.NetworkInterfaces.listAll","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.listByResourceGroup":"Microsoft.AzureStackHCI.NetworkInterfaces.listByResourceGroup","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkInterfacesClient.update":"Microsoft.AzureStackHCI.NetworkInterfaces.update","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient":"Microsoft.AzureStackHCI.NetworkSecurityGroups","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.beginCreateOrUpdate":"Microsoft.AzureStackHCI.NetworkSecurityGroups.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.beginDelete":"Microsoft.AzureStackHCI.NetworkSecurityGroups.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.beginUpdateTags":"Microsoft.AzureStackHCI.NetworkSecurityGroups.updateTags","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.createOrUpdate":"Microsoft.AzureStackHCI.NetworkSecurityGroups.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.delete":"Microsoft.AzureStackHCI.NetworkSecurityGroups.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.getByResourceGroup":"Microsoft.AzureStackHCI.NetworkSecurityGroups.get","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.getByResourceGroupWithResponse":"Microsoft.AzureStackHCI.NetworkSecurityGroups.get","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.list":"Microsoft.AzureStackHCI.NetworkSecurityGroups.listAll","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.listByResourceGroup":"Microsoft.AzureStackHCI.NetworkSecurityGroups.listByResourceGroup","com.azure.resourcemanager.azurestackhci.vm.fluent.NetworkSecurityGroupsClient.updateTags":"Microsoft.AzureStackHCI.NetworkSecurityGroups.updateTags","com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient":"Microsoft.AzureStackHCI.SecurityRules","com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.beginCreateOrUpdate":"Microsoft.AzureStackHCI.SecurityRules.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.beginDelete":"Microsoft.AzureStackHCI.SecurityRules.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.createOrUpdate":"Microsoft.AzureStackHCI.SecurityRules.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.delete":"Microsoft.AzureStackHCI.SecurityRules.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.get":"Microsoft.AzureStackHCI.SecurityRules.get","com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.getWithResponse":"Microsoft.AzureStackHCI.SecurityRules.get","com.azure.resourcemanager.azurestackhci.vm.fluent.SecurityRulesClient.listByNetworkSecurityGroup":"Microsoft.AzureStackHCI.SecurityRules.listByNetworkSecurityGroup","com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient":"Microsoft.AzureStackHCI.StorageContainers","com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.beginCreateOrUpdate":"Microsoft.AzureStackHCI.StorageContainers.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.beginDelete":"Microsoft.AzureStackHCI.StorageContainers.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.beginUpdate":"Microsoft.AzureStackHCI.StorageContainers.update","com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.createOrUpdate":"Microsoft.AzureStackHCI.StorageContainers.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.delete":"Microsoft.AzureStackHCI.StorageContainers.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.getByResourceGroup":"Microsoft.AzureStackHCI.StorageContainers.get","com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.getByResourceGroupWithResponse":"Microsoft.AzureStackHCI.StorageContainers.get","com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.list":"Microsoft.AzureStackHCI.StorageContainers.listAll","com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.listByResourceGroup":"Microsoft.AzureStackHCI.StorageContainers.listByResourceGroup","com.azure.resourcemanager.azurestackhci.vm.fluent.StorageContainersClient.update":"Microsoft.AzureStackHCI.StorageContainers.update","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient":"Microsoft.AzureStackHCI.VirtualHardDisks","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.beginCreateOrUpdate":"Microsoft.AzureStackHCI.VirtualHardDisks.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.beginDelete":"Microsoft.AzureStackHCI.VirtualHardDisks.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.beginUpdate":"Microsoft.AzureStackHCI.VirtualHardDisks.update","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.beginUpload":"Microsoft.AzureStackHCI.VirtualHardDisks.upload","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.createOrUpdate":"Microsoft.AzureStackHCI.VirtualHardDisks.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.delete":"Microsoft.AzureStackHCI.VirtualHardDisks.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.getByResourceGroup":"Microsoft.AzureStackHCI.VirtualHardDisks.get","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.getByResourceGroupWithResponse":"Microsoft.AzureStackHCI.VirtualHardDisks.get","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.list":"Microsoft.AzureStackHCI.VirtualHardDisks.listAll","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.listByResourceGroup":"Microsoft.AzureStackHCI.VirtualHardDisks.listByResourceGroup","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.update":"Microsoft.AzureStackHCI.VirtualHardDisks.update","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualHardDisksClient.upload":"Microsoft.AzureStackHCI.VirtualHardDisks.upload","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient":"Microsoft.AzureStackHCI.VirtualMachineInstances","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginCreateOrUpdate":"Microsoft.AzureStackHCI.VirtualMachineInstances.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginDelete":"Microsoft.AzureStackHCI.VirtualMachineInstances.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginPause":"Microsoft.AzureStackHCI.VirtualMachineInstances.pause","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginRestart":"Microsoft.AzureStackHCI.VirtualMachineInstances.restart","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginSave":"Microsoft.AzureStackHCI.VirtualMachineInstances.save","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginStart":"Microsoft.AzureStackHCI.VirtualMachineInstances.start","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginStop":"Microsoft.AzureStackHCI.VirtualMachineInstances.stop","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.beginUpdate":"Microsoft.AzureStackHCI.VirtualMachineInstances.update","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.createOrUpdate":"Microsoft.AzureStackHCI.VirtualMachineInstances.createOrUpdate","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.delete":"Microsoft.AzureStackHCI.VirtualMachineInstances.delete","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.get":"Microsoft.AzureStackHCI.VirtualMachineInstances.get","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.getWithResponse":"Microsoft.AzureStackHCI.VirtualMachineInstances.get","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.list":"Microsoft.AzureStackHCI.VirtualMachineInstances.list","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.pause":"Microsoft.AzureStackHCI.VirtualMachineInstances.pause","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.restart":"Microsoft.AzureStackHCI.VirtualMachineInstances.restart","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.save":"Microsoft.AzureStackHCI.VirtualMachineInstances.save","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.start":"Microsoft.AzureStackHCI.VirtualMachineInstances.start","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.stop":"Microsoft.AzureStackHCI.VirtualMachineInstances.stop","com.azure.resourcemanager.azurestackhci.vm.fluent.VirtualMachineInstancesClient.update":"Microsoft.AzureStackHCI.VirtualMachineInstances.update","com.azure.resourcemanager.azurestackhci.vm.fluent.models.AttestationStatusInner":"Microsoft.AzureStackHCI.AttestationStatus","com.azure.resourcemanager.azurestackhci.vm.fluent.models.GalleryImageInner":"Microsoft.AzureStackHCI.GalleryImage","com.azure.resourcemanager.azurestackhci.vm.fluent.models.GalleryImageVersionProperties":"Microsoft.AzureStackHCI.GalleryImageVersionProperties","com.azure.resourcemanager.azurestackhci.vm.fluent.models.GuestAgentInner":"Microsoft.AzureStackHCI.GuestAgent","com.azure.resourcemanager.azurestackhci.vm.fluent.models.HybridIdentityMetadataInner":"Microsoft.AzureStackHCI.HybridIdentityMetadata","com.azure.resourcemanager.azurestackhci.vm.fluent.models.LogicalNetworkInner":"Microsoft.AzureStackHCI.LogicalNetwork","com.azure.resourcemanager.azurestackhci.vm.fluent.models.MarketplaceGalleryImageInner":"Microsoft.AzureStackHCI.MarketplaceGalleryImage","com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkInterfaceInner":"Microsoft.AzureStackHCI.NetworkInterface","com.azure.resourcemanager.azurestackhci.vm.fluent.models.NetworkSecurityGroupInner":"Microsoft.AzureStackHCI.NetworkSecurityGroup","com.azure.resourcemanager.azurestackhci.vm.fluent.models.RouteProperties":"Microsoft.AzureStackHCI.RouteProperties","com.azure.resourcemanager.azurestackhci.vm.fluent.models.RouteTableProperties":"Microsoft.AzureStackHCI.RouteTableProperties","com.azure.resourcemanager.azurestackhci.vm.fluent.models.SecurityRuleInner":"Microsoft.AzureStackHCI.SecurityRule","com.azure.resourcemanager.azurestackhci.vm.fluent.models.StorageContainerInner":"Microsoft.AzureStackHCI.StorageContainer","com.azure.resourcemanager.azurestackhci.vm.fluent.models.SubnetProperties":"Microsoft.AzureStackHCI.SubnetProperties","com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskInner":"Microsoft.AzureStackHCI.VirtualHardDisk","com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualHardDiskUploadResponseInner":"Microsoft.AzureStackHCI.VirtualHardDiskUploadResponse","com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner":"Microsoft.AzureStackHCI.VirtualMachineInstance","com.azure.resourcemanager.azurestackhci.vm.implementation.AzureStackHciVmMgmtClientBuilder":"Microsoft.AzureStackHCI","com.azure.resourcemanager.azurestackhci.vm.implementation.models.GalleryImageListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.azurestackhci.vm.implementation.models.GuestAgentListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.azurestackhci.vm.implementation.models.HybridIdentityMetadataListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.azurestackhci.vm.implementation.models.LogicalNetworkListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.azurestackhci.vm.implementation.models.MarketplaceGalleryImageListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.azurestackhci.vm.implementation.models.NetworkInterfaceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.azurestackhci.vm.implementation.models.NetworkSecurityGroupListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.azurestackhci.vm.implementation.models.SecurityRuleListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.azurestackhci.vm.implementation.models.StorageContainerListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.azurestackhci.vm.implementation.models.VirtualHardDiskListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.azurestackhci.vm.implementation.models.VirtualMachineInstanceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.azurestackhci.vm.models.AttestBootIntegrityPropertyEnum":"Microsoft.AzureStackHCI.AttestBootIntegrityPropertyEnum","com.azure.resourcemanager.azurestackhci.vm.models.AttestCertPropertyEnum":"Microsoft.AzureStackHCI.AttestCertPropertyEnum","com.azure.resourcemanager.azurestackhci.vm.models.AttestDiskSecurityEncryptionTypeEnum":"Microsoft.AzureStackHCI.AttestDiskSecurityEncryptionTypeEnum","com.azure.resourcemanager.azurestackhci.vm.models.AttestHWPlatformEnum":"Microsoft.AzureStackHCI.AttestHWPlatformEnum","com.azure.resourcemanager.azurestackhci.vm.models.AttestHealthStatusEnum":"Microsoft.AzureStackHCI.AttestHealthStatusEnum","com.azure.resourcemanager.azurestackhci.vm.models.AttestSecureBootPropertyEnum":"Microsoft.AzureStackHCI.AttestSecureBootPropertyEnum","com.azure.resourcemanager.azurestackhci.vm.models.AttestationStatusProperties":"Microsoft.AzureStackHCI.AttestationStatusProperties","com.azure.resourcemanager.azurestackhci.vm.models.CloudInitDataSource":"Microsoft.AzureStackHCI.CloudInitDataSource","com.azure.resourcemanager.azurestackhci.vm.models.DiskFileFormat":"Microsoft.AzureStackHCI.DiskFileFormat","com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation":"Microsoft.AzureStackHCI.ExtendedLocation","com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes":"Microsoft.AzureStackHCI.ExtendedLocationTypes","com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageIdentifier":"Microsoft.AzureStackHCI.GalleryImageIdentifier","com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageProperties":"Microsoft.AzureStackHCI.GalleryImageProperties","com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageStatus":"Microsoft.AzureStackHCI.GalleryImageStatus","com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageStatusDownloadStatus":"Microsoft.AzureStackHCI.GalleryImageStatusDownloadStatus","com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageStatusProvisioningStatus":"Microsoft.AzureStackHCI.GalleryImageStatusProvisioningStatus","com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageTagsUpdate":"Azure.ResourceManager.Foundations.TagsUpdateModel","com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageVersion":"Microsoft.AzureStackHCI.GalleryImageVersion","com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageVersionStorageProfile":"Microsoft.AzureStackHCI.GalleryImageVersionStorageProfile","com.azure.resourcemanager.azurestackhci.vm.models.GalleryOSDiskImage":"Microsoft.AzureStackHCI.GalleryOSDiskImage","com.azure.resourcemanager.azurestackhci.vm.models.GpuAssignmentTypeEnum":"Microsoft.AzureStackHCI.GpuAssignmentTypeEnum","com.azure.resourcemanager.azurestackhci.vm.models.GuestAgentInstallStatus":"Microsoft.AzureStackHCI.GuestAgentInstallStatus","com.azure.resourcemanager.azurestackhci.vm.models.GuestAgentProperties":"Microsoft.AzureStackHCI.GuestAgentProperties","com.azure.resourcemanager.azurestackhci.vm.models.GuestCredential":"Microsoft.AzureStackHCI.GuestCredential","com.azure.resourcemanager.azurestackhci.vm.models.HardwareProfileUpdate":"Microsoft.AzureStackHCI.HardwareProfileUpdate","com.azure.resourcemanager.azurestackhci.vm.models.HttpProxyConfiguration":"Microsoft.AzureStackHCI.HttpProxyConfiguration","com.azure.resourcemanager.azurestackhci.vm.models.HybridIdentityMetadataProperties":"Microsoft.AzureStackHCI.HybridIdentityMetadataProperties","com.azure.resourcemanager.azurestackhci.vm.models.HyperVGeneration":"Microsoft.AzureStackHCI.HyperVGeneration","com.azure.resourcemanager.azurestackhci.vm.models.IPConfiguration":"Microsoft.AzureStackHCI.IPConfiguration","com.azure.resourcemanager.azurestackhci.vm.models.IPConfigurationProperties":"Microsoft.AzureStackHCI.IPConfigurationProperties","com.azure.resourcemanager.azurestackhci.vm.models.IPPool":"Microsoft.AzureStackHCI.IPPool","com.azure.resourcemanager.azurestackhci.vm.models.IPPoolInfo":"Microsoft.AzureStackHCI.IPPoolInfo","com.azure.resourcemanager.azurestackhci.vm.models.IPPoolTypeEnum":"Microsoft.AzureStackHCI.IPPoolTypeEnum","com.azure.resourcemanager.azurestackhci.vm.models.Identity":"Microsoft.AzureStackHCI.Identity","com.azure.resourcemanager.azurestackhci.vm.models.IdentityType":null,"com.azure.resourcemanager.azurestackhci.vm.models.ImageArmReference":"Microsoft.AzureStackHCI.ImageArmReference","com.azure.resourcemanager.azurestackhci.vm.models.InstanceViewStatus":"Microsoft.AzureStackHCI.InstanceViewStatus","com.azure.resourcemanager.azurestackhci.vm.models.InterfaceDNSSettings":"Microsoft.AzureStackHCI.InterfaceDNSSettings","com.azure.resourcemanager.azurestackhci.vm.models.IpAllocationMethodEnum":"Microsoft.AzureStackHCI.IpAllocationMethodEnum","com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkArmReference":"Microsoft.AzureStackHCI.LogicalNetworkArmReference","com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkProperties":"Microsoft.AzureStackHCI.LogicalNetworkProperties","com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkPropertiesDhcpOptions":"Microsoft.AzureStackHCI.LogicalNetworkPropertiesDhcpOptions","com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkStatus":"Microsoft.AzureStackHCI.LogicalNetworkStatus","com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkStatusProvisioningStatus":"Microsoft.AzureStackHCI.LogicalNetworkStatusProvisioningStatus","com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkTypeEnum":"Microsoft.AzureStackHCI.LogicalNetworkTypeEnum","com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworksUpdateRequest":"Microsoft.AzureStackHCI.LogicalNetworksUpdateRequest","com.azure.resourcemanager.azurestackhci.vm.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","com.azure.resourcemanager.azurestackhci.vm.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageProperties":"Microsoft.AzureStackHCI.MarketplaceGalleryImageProperties","com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageStatus":"Microsoft.AzureStackHCI.MarketplaceGalleryImageStatus","com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageStatusDownloadStatus":"Microsoft.AzureStackHCI.MarketplaceGalleryImageStatusDownloadStatus","com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageStatusProvisioningStatus":"Microsoft.AzureStackHCI.MarketplaceGalleryImageStatusProvisioningStatus","com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageTagsUpdate":"Azure.ResourceManager.Foundations.TagsUpdateModel","com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceArmReference":"Microsoft.AzureStackHCI.NetworkInterfaceArmReference","com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceProperties":"Microsoft.AzureStackHCI.NetworkInterfaceProperties","com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceStatus":"Microsoft.AzureStackHCI.NetworkInterfaceStatus","com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceStatusProvisioningStatus":"Microsoft.AzureStackHCI.NetworkInterfaceStatusProvisioningStatus","com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfacesUpdateProperties":"Microsoft.AzureStackHCI.NetworkInterfacesUpdateProperties","com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfacesUpdateRequest":"Microsoft.AzureStackHCI.NetworkInterfacesUpdateRequest","com.azure.resourcemanager.azurestackhci.vm.models.NetworkProfileUpdate":"Microsoft.AzureStackHCI.NetworkProfileUpdate","com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupArmReference":"Microsoft.AzureStackHCI.NetworkSecurityGroupArmReference","com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupProperties":"Microsoft.AzureStackHCI.NetworkSecurityGroupProperties","com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupStatus":"Microsoft.AzureStackHCI.NetworkSecurityGroupStatus","com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupStatusProvisioningStatus":"Microsoft.AzureStackHCI.NetworkSecurityGroupStatusProvisioningStatus","com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupTagsUpdate":"Azure.ResourceManager.Foundations.TagsUpdateModel","com.azure.resourcemanager.azurestackhci.vm.models.OperatingSystemTypes":"Microsoft.AzureStackHCI.OperatingSystemTypes","com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdate":"Microsoft.AzureStackHCI.OsProfileUpdate","com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateLinuxConfiguration":"Microsoft.AzureStackHCI.OsProfileUpdateLinuxConfiguration","com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateWindowsConfiguration":"Microsoft.AzureStackHCI.OsProfileUpdateWindowsConfiguration","com.azure.resourcemanager.azurestackhci.vm.models.PowerStateEnum":"Microsoft.AzureStackHCI.PowerStateEnum","com.azure.resourcemanager.azurestackhci.vm.models.ProvisioningAction":"Microsoft.AzureStackHCI.ProvisioningAction","com.azure.resourcemanager.azurestackhci.vm.models.ProvisioningStateEnum":"Microsoft.AzureStackHCI.ProvisioningStateEnum","com.azure.resourcemanager.azurestackhci.vm.models.Route":"Microsoft.AzureStackHCI.Route","com.azure.resourcemanager.azurestackhci.vm.models.RouteTable":"Microsoft.AzureStackHCI.RouteTable","com.azure.resourcemanager.azurestackhci.vm.models.SecurityEncryptionType":"Microsoft.AzureStackHCI.SecurityEncryptionType","com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleAccess":"Microsoft.AzureStackHCI.SecurityRuleAccess","com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleDirection":"Microsoft.AzureStackHCI.SecurityRuleDirection","com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProperties":"Microsoft.AzureStackHCI.SecurityRuleProperties","com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProtocol":"Microsoft.AzureStackHCI.SecurityRuleProtocol","com.azure.resourcemanager.azurestackhci.vm.models.SecurityTypes":"Microsoft.AzureStackHCI.SecurityTypes","com.azure.resourcemanager.azurestackhci.vm.models.SshConfiguration":"Microsoft.AzureStackHCI.SshConfiguration","com.azure.resourcemanager.azurestackhci.vm.models.SshPublicKey":"Microsoft.AzureStackHCI.SshPublicKey","com.azure.resourcemanager.azurestackhci.vm.models.Status":"Microsoft.AzureStackHCI.Status","com.azure.resourcemanager.azurestackhci.vm.models.StatusLevelTypes":"Microsoft.AzureStackHCI.StatusLevelTypes","com.azure.resourcemanager.azurestackhci.vm.models.StatusTypes":"Microsoft.AzureStackHCI.StatusTypes","com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerProperties":"Microsoft.AzureStackHCI.StorageContainerProperties","com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerStatus":"Microsoft.AzureStackHCI.StorageContainerStatus","com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerStatusProvisioningStatus":"Microsoft.AzureStackHCI.StorageContainerStatusProvisioningStatus","com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerTagsUpdate":"Azure.ResourceManager.Foundations.TagsUpdateModel","com.azure.resourcemanager.azurestackhci.vm.models.StorageProfileUpdate":"Microsoft.AzureStackHCI.StorageProfileUpdate","com.azure.resourcemanager.azurestackhci.vm.models.Subnet":"Microsoft.AzureStackHCI.Subnet","com.azure.resourcemanager.azurestackhci.vm.models.SubnetIpConfigurationReference":"Microsoft.AzureStackHCI.SubnetIpConfigurationReference","com.azure.resourcemanager.azurestackhci.vm.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity","com.azure.resourcemanager.azurestackhci.vm.models.VMDiskSecurityProfile":"Microsoft.AzureStackHCI.VMDiskSecurityProfile","com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskArmReference":"Microsoft.AzureStackHCI.VirtualHardDiskArmReference","com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskDownloadStatus":"Microsoft.AzureStackHCI.VirtualHardDiskDownloadStatus","com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskProperties":"Microsoft.AzureStackHCI.VirtualHardDiskProperties","com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskStatus":"Microsoft.AzureStackHCI.VirtualHardDiskStatus","com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskStatusProvisioningStatus":"Microsoft.AzureStackHCI.VirtualHardDiskStatusProvisioningStatus","com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadRequest":"Microsoft.AzureStackHCI.VirtualHardDiskUploadRequest","com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadStatus":"Microsoft.AzureStackHCI.VirtualHardDiskUploadStatus","com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisksUpdateProperties":"Microsoft.AzureStackHCI.VirtualHardDisksUpdateProperties","com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisksUpdateRequest":"Microsoft.AzureStackHCI.VirtualHardDisksUpdateRequest","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineConfigAgentInstanceView":"Microsoft.AzureStackHCI.VirtualMachineConfigAgentInstanceView","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceManagedDiskParameters":"Microsoft.AzureStackHCI.VirtualMachineInstanceManagedDiskParameters","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceProperties":"Microsoft.AzureStackHCI.VirtualMachineInstanceProperties","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfile":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesHardwareProfile","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesNetworkProfile":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesNetworkProfile","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesOsProfile":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesOsProfile","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesOsProfileLinuxConfiguration":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesOsProfileLinuxConfiguration","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesPlacementProfile":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesPlacementProfile","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesSecurityProfile":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesSecurityProfile","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesSecurityProfileUefiSettings":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesSecurityProfileUefiSettings","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesStorageProfile":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesStorageProfile","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesStorageProfileOsDisk":"Microsoft.AzureStackHCI.VirtualMachineInstancePropertiesStorageProfileOsDisk","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceStatus":"Microsoft.AzureStackHCI.VirtualMachineInstanceStatus","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceStatusProvisioningStatus":"Microsoft.AzureStackHCI.VirtualMachineInstanceStatusProvisioningStatus","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateProperties":"Microsoft.AzureStackHCI.VirtualMachineInstanceUpdateProperties","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateRequest":"Microsoft.AzureStackHCI.VirtualMachineInstanceUpdateRequest","com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceView":"Microsoft.AzureStackHCI.VirtualMachineInstanceView","com.azure.resourcemanager.azurestackhci.vm.models.VmImageRepositoryCredentials":"Microsoft.AzureStackHCI.VmImageRepositoryCredentials","com.azure.resourcemanager.azurestackhci.vm.models.VmSizeEnum":"Microsoft.AzureStackHCI.VmSizeEnum"}} \ No newline at end of file diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurestackhci-vm/proxy-config.json b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurestackhci-vm/proxy-config.json new file mode 100644 index 000000000000..372b47a927f0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurestackhci-vm/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.azurestackhci.vm.implementation.AttestationStatusesClientImpl$AttestationStatusesService"],["com.azure.resourcemanager.azurestackhci.vm.implementation.GalleryImagesClientImpl$GalleryImagesService"],["com.azure.resourcemanager.azurestackhci.vm.implementation.GuestAgentsClientImpl$GuestAgentsService"],["com.azure.resourcemanager.azurestackhci.vm.implementation.HybridIdentityMetadatasClientImpl$HybridIdentityMetadatasService"],["com.azure.resourcemanager.azurestackhci.vm.implementation.LogicalNetworksClientImpl$LogicalNetworksService"],["com.azure.resourcemanager.azurestackhci.vm.implementation.MarketplaceGalleryImagesClientImpl$MarketplaceGalleryImagesService"],["com.azure.resourcemanager.azurestackhci.vm.implementation.NetworkInterfacesClientImpl$NetworkInterfacesService"],["com.azure.resourcemanager.azurestackhci.vm.implementation.NetworkSecurityGroupsClientImpl$NetworkSecurityGroupsService"],["com.azure.resourcemanager.azurestackhci.vm.implementation.SecurityRulesClientImpl$SecurityRulesService"],["com.azure.resourcemanager.azurestackhci.vm.implementation.StorageContainersClientImpl$StorageContainersService"],["com.azure.resourcemanager.azurestackhci.vm.implementation.VirtualHardDisksClientImpl$VirtualHardDisksService"],["com.azure.resourcemanager.azurestackhci.vm.implementation.VirtualMachineInstancesClientImpl$VirtualMachineInstancesService"]] \ No newline at end of file diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurestackhci-vm/reflect-config.json b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurestackhci-vm/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-azurestackhci-vm/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/azure-resourcemanager-azurestackhci-vm.properties b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/azure-resourcemanager-azurestackhci-vm.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/main/resources/azure-resourcemanager-azurestackhci-vm.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusesGetSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusesGetSamples.java new file mode 100644 index 000000000000..9a9b236c5b97 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusesGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for AttestationStatuses Get. + */ +public final class AttestationStatusesGetSamples { + /* + * x-ms-original-file: 2025-06-01-preview/AttestationStatuses_Get.json + */ + /** + * Sample code: GetAttestationStatus. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getAttestationStatus(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.attestationStatuses() + .getWithResponse( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesCreateOrUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..66102691430c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesCreateOrUpdateSamples.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.OperatingSystemTypes; + +/** + * Samples for GalleryImages CreateOrUpdate. + */ +public final class GalleryImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_CreateOrUpdate.json + */ + /** + * Sample code: PutGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.galleryImages() + .define("test-gallery-image") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withProperties(new GalleryImageProperties().withContainerId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container") + .withImagePath("C:\\test.vhdx") + .withOsType(OperatingSystemTypes.LINUX)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesDeleteSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesDeleteSamples.java new file mode 100644 index 000000000000..011bf3e11eaa --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for GalleryImages Delete. + */ +public final class GalleryImagesDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_Delete.json + */ + /** + * Sample code: DeleteGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void deleteGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.galleryImages().delete("test-rg", "test-gallery-image", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesGetByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..e4101874afc8 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for GalleryImages GetByResourceGroup. + */ +public final class GalleryImagesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_Get.json + */ + /** + * Sample code: GetGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.galleryImages() + .getByResourceGroupWithResponse("test-rg", "test-gallery-image", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesListByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesListByResourceGroupSamples.java new file mode 100644 index 000000000000..aac7019efe5a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for GalleryImages ListByResourceGroup. + */ +public final class GalleryImagesListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_ListByResourceGroup.json + */ + /** + * Sample code: ListGalleryImageByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listGalleryImageByResourceGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.galleryImages().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesListSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesListSamples.java new file mode 100644 index 000000000000..ea3fb4f97d4f --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for GalleryImages List. + */ +public final class GalleryImagesListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_ListAll.json + */ + /** + * Sample code: ListGalleryImageBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listGalleryImageBySubscription(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.galleryImages().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesUpdateSamples.java new file mode 100644 index 000000000000..dee78d5a3387 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImagesUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImage; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for GalleryImages Update. + */ +public final class GalleryImagesUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GalleryImages_Update.json + */ + /** + * Sample code: UpdateGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void updateGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + GalleryImage resource = manager.galleryImages() + .getByResourceGroupWithResponse("test-rg", "test-gallery-image", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsCreateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsCreateSamples.java new file mode 100644 index 000000000000..aaf12c2d0535 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsCreateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GuestAgentInner; +import com.azure.resourcemanager.azurestackhci.vm.models.GuestAgentProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.GuestCredential; +import com.azure.resourcemanager.azurestackhci.vm.models.ProvisioningAction; + +/** + * Samples for GuestAgents Create. + */ +public final class GuestAgentsCreateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GuestAgents_Create.json + */ + /** + * Sample code: CreateGuestAgent. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void createGuestAgent(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.guestAgents() + .create( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new GuestAgentInner().withProperties(new GuestAgentProperties() + .withCredentials( + new GuestCredential().withUsername("tempuser").withPassword("fakeTokenPlaceholder")) + .withProvisioningAction(ProvisioningAction.INSTALL)), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsDeleteSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsDeleteSamples.java new file mode 100644 index 000000000000..a75e0a7f1024 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for GuestAgents Delete. + */ +public final class GuestAgentsDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GuestAgents_Delete.json + */ + /** + * Sample code: DeleteGuestAgent. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void deleteGuestAgent(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.guestAgents() + .delete( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsGetSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsGetSamples.java new file mode 100644 index 000000000000..62e29a845c88 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for GuestAgents Get. + */ +public final class GuestAgentsGetSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GuestAgents_Get.json + */ + /** + * Sample code: GetGuestAgent. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getGuestAgent(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.guestAgents() + .getWithResponse( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsListByVirtualMachineInstanceSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsListByVirtualMachineInstanceSamples.java new file mode 100644 index 000000000000..7eb51c180705 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/GuestAgentsListByVirtualMachineInstanceSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for GuestAgents ListByVirtualMachineInstance. + */ +public final class GuestAgentsListByVirtualMachineInstanceSamples { + /* + * x-ms-original-file: 2025-06-01-preview/GuestAgents_ListByVirtualMachineInstance.json + */ + /** + * Sample code: GuestAgentListByVirtualMachineInstances. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void guestAgentListByVirtualMachineInstances( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.guestAgents() + .listByVirtualMachineInstance( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/HybridIdentityMetadataGetSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/HybridIdentityMetadataGetSamples.java new file mode 100644 index 000000000000..ff2d48763408 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/HybridIdentityMetadataGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for HybridIdentityMetadata Get. + */ +public final class HybridIdentityMetadataGetSamples { + /* + * x-ms-original-file: 2025-06-01-preview/HybridIdentityMetadataGroup_Get.json + */ + /** + * Sample code: GetHybridIdentityMetadata. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + getHybridIdentityMetadata(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.hybridIdentityMetadatas() + .getWithResponse( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/HybridIdentityMetadataListByVirtualMachineInstanceSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/HybridIdentityMetadataListByVirtualMachineInstanceSamples.java new file mode 100644 index 000000000000..4cde69d6d0d0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/HybridIdentityMetadataListByVirtualMachineInstanceSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for HybridIdentityMetadata ListByVirtualMachineInstance. + */ +public final class HybridIdentityMetadataListByVirtualMachineInstanceSamples { + /* + * x-ms-original-file: 2025-06-01-preview/HybridIdentityMetadata_ListByVirtualMachineInstance.json + */ + /** + * Sample code: HybridIdentityMetadataListByVirtualMachineInstances. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void hybridIdentityMetadataListByVirtualMachineInstances( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.hybridIdentityMetadatas() + .listByVirtualMachineInstance( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksCreateOrUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a391eb3c8aa7 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksCreateOrUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; + +/** + * Samples for LogicalNetworks CreateOrUpdate. + */ +public final class LogicalNetworksCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_CreateOrUpdate.json + */ + /** + * Sample code: PutLogicalNetwork. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putLogicalNetwork(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.logicalNetworks() + .define("test-lnet") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksDeleteSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksDeleteSamples.java new file mode 100644 index 000000000000..18972127c52e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for LogicalNetworks Delete. + */ +public final class LogicalNetworksDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_Delete.json + */ + /** + * Sample code: DeleteLogicalNetwork. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void deleteLogicalNetwork(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.logicalNetworks().delete("test-rg", "test-lnet", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksGetByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksGetByResourceGroupSamples.java new file mode 100644 index 000000000000..f5f0f569aacd --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for LogicalNetworks GetByResourceGroup. + */ +public final class LogicalNetworksGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_Get.json + */ + /** + * Sample code: GetLogicalNetwork. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getLogicalNetwork(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.logicalNetworks() + .getByResourceGroupWithResponse("test-rg", "test-lnet", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksListByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksListByResourceGroupSamples.java new file mode 100644 index 000000000000..a6322fa039a5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for LogicalNetworks ListByResourceGroup. + */ +public final class LogicalNetworksListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_ListByResourceGroup.json + */ + /** + * Sample code: ListLogicalNetworkByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listLogicalNetworkByResourceGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.logicalNetworks().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksListSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksListSamples.java new file mode 100644 index 000000000000..341ffb4c244e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for LogicalNetworks List. + */ +public final class LogicalNetworksListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_ListAll.json + */ + /** + * Sample code: ListLogicalNetworkBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listLogicalNetworkBySubscription(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.logicalNetworks().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksUpdateSamples.java new file mode 100644 index 000000000000..c19f891256b3 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetwork; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for LogicalNetworks Update. + */ +public final class LogicalNetworksUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/LogicalNetworks_Update.json + */ + /** + * Sample code: UpdateLogicalNetwork. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void updateLogicalNetwork(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + LogicalNetwork resource = manager.logicalNetworks() + .getByResourceGroupWithResponse("test-rg", "test-lnet", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesCreateOrUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..8ebb90b15efd --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesCreateOrUpdateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.CloudInitDataSource; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageIdentifier; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageVersion; +import com.azure.resourcemanager.azurestackhci.vm.models.HyperVGeneration; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.OperatingSystemTypes; + +/** + * Samples for MarketplaceGalleryImages CreateOrUpdate. + */ +public final class MarketplaceGalleryImagesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_CreateOrUpdate.json + */ + /** + * Sample code: PutMarketplaceGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + putMarketplaceGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.marketplaceGalleryImages() + .define("test-marketplace-gallery-image") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withProperties(new MarketplaceGalleryImageProperties().withContainerId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container") + .withOsType(OperatingSystemTypes.WINDOWS) + .withCloudInitDataSource(CloudInitDataSource.AZURE) + .withHyperVGeneration(HyperVGeneration.V1) + .withIdentifier(new GalleryImageIdentifier().withPublisher("myPublisherName") + .withOffer("myOfferName") + .withSku("mySkuName")) + .withVersion(new GalleryImageVersion().withName("1.0.0"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesDeleteSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesDeleteSamples.java new file mode 100644 index 000000000000..9d6741892d1b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for MarketplaceGalleryImages Delete. + */ +public final class MarketplaceGalleryImagesDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_Delete.json + */ + /** + * Sample code: DeleteMarketplaceGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + deleteMarketplaceGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.marketplaceGalleryImages() + .delete("test-rg", "test-marketplace-gallery-image", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesGetByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..959c1405e22d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesGetByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for MarketplaceGalleryImages GetByResourceGroup. + */ +public final class MarketplaceGalleryImagesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_Get.json + */ + /** + * Sample code: GetMarketplaceGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + getMarketplaceGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.marketplaceGalleryImages() + .getByResourceGroupWithResponse("test-rg", "test-marketplace-gallery-image", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesListByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesListByResourceGroupSamples.java new file mode 100644 index 000000000000..7fbc1384f6f5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for MarketplaceGalleryImages ListByResourceGroup. + */ +public final class MarketplaceGalleryImagesListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_ListByResourceGroup.json + */ + /** + * Sample code: ListMarketplaceGalleryImageByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void listMarketplaceGalleryImageByResourceGroup( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.marketplaceGalleryImages().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesListSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesListSamples.java new file mode 100644 index 000000000000..6795ce0e8a9e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for MarketplaceGalleryImages List. + */ +public final class MarketplaceGalleryImagesListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_ListAll.json + */ + /** + * Sample code: ListMarketplaceGalleryImageBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void listMarketplaceGalleryImageBySubscription( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.marketplaceGalleryImages().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesUpdateSamples.java new file mode 100644 index 000000000000..07ec5b7cda18 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImagesUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImage; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for MarketplaceGalleryImages Update. + */ +public final class MarketplaceGalleryImagesUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/MarketplaceGalleryImages_Update.json + */ + /** + * Sample code: UpdateMarketplaceGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + updateMarketplaceGalleryImage(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + MarketplaceGalleryImage resource = manager.marketplaceGalleryImages() + .getByResourceGroupWithResponse("test-rg", "test-marketplce-gallery-image", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesCreateOrUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..3ffb45a7b205 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesCreateOrUpdateSamples.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.IPConfiguration; +import com.azure.resourcemanager.azurestackhci.vm.models.IPConfigurationProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceProperties; +import java.util.Arrays; + +/** + * Samples for NetworkInterfaces CreateOrUpdate. + */ +public final class NetworkInterfacesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces__CreateOrUpdate_CreateFromLocal.json + */ + /** + * Sample code: CreateNetworkInterfaceFromLocal. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + createNetworkInterfaceFromLocal(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces() + .define("test-nic") + .withRegion("eastus") + .withExistingResourceGroup("test-rg") + .withProperties(new NetworkInterfaceProperties().withIpConfigurations(Arrays.asList(new IPConfiguration() + .withName("ipconfig-sample") + .withProperties(new IPConfigurationProperties().withSubnet(new LogicalNetworkArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet"))))) + .withCreateFromLocal(true)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } + + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_CreateOrUpdate.json + */ + /** + * Sample code: PutNetworkInterface. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putNetworkInterface(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces() + .define("test-nic") + .withRegion("eastus") + .withExistingResourceGroup("test-rg") + .withProperties(new NetworkInterfaceProperties().withIpConfigurations(Arrays.asList(new IPConfiguration() + .withName("ipconfig-sample") + .withProperties(new IPConfigurationProperties().withSubnet(new LogicalNetworkArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/logicalNetworks/test-lnet")))))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesDeleteSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesDeleteSamples.java new file mode 100644 index 000000000000..edeb7d00686c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for NetworkInterfaces Delete. + */ +public final class NetworkInterfacesDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_Delete.json + */ + /** + * Sample code: DeleteNetworkInterface. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + deleteNetworkInterface(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces().delete("test-rg", "test-nic", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesGetByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..826a1dd9301d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for NetworkInterfaces GetByResourceGroup. + */ +public final class NetworkInterfacesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_Get.json + */ + /** + * Sample code: GetNetworkInterface. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getNetworkInterface(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces() + .getByResourceGroupWithResponse("test-rg", "test-nic", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesListByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesListByResourceGroupSamples.java new file mode 100644 index 000000000000..211c3b024371 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for NetworkInterfaces ListByResourceGroup. + */ +public final class NetworkInterfacesListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_ListByResourceGroup.json + */ + /** + * Sample code: ListNetworkInterfaceByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listNetworkInterfaceByResourceGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesListSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesListSamples.java new file mode 100644 index 000000000000..f7ebb7ada559 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for NetworkInterfaces List. + */ +public final class NetworkInterfacesListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_ListAll.json + */ + /** + * Sample code: ListNetworkInterfaceBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listNetworkInterfaceBySubscription(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkInterfaces().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesUpdateSamples.java new file mode 100644 index 000000000000..c01318457435 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterface; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for NetworkInterfaces Update. + */ +public final class NetworkInterfacesUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkInterfaces_Update.json + */ + /** + * Sample code: UpdateNetworkInterface. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + updateNetworkInterface(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + NetworkInterface resource = manager.networkInterfaces() + .getByResourceGroupWithResponse("test-rg", "test-nic", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsCreateOrUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..e691aa84a7b0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsCreateOrUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for NetworkSecurityGroups CreateOrUpdate. + */ +public final class NetworkSecurityGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_CreateOrUpdate.json + */ + /** + * Sample code: CreateNetworkSecurityGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + createNetworkSecurityGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkSecurityGroups() + .define("testnsg") + .withRegion("eastus") + .withExistingResourceGroup("testrg") + .create(); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsDeleteSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsDeleteSamples.java new file mode 100644 index 000000000000..3bb574980447 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for NetworkSecurityGroups Delete. + */ +public final class NetworkSecurityGroupsDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_Delete.json + */ + /** + * Sample code: Delete network security group. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + deleteNetworkSecurityGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkSecurityGroups().delete("test-rg", "testnsg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsGetByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..315967cde295 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for NetworkSecurityGroups GetByResourceGroup. + */ +public final class NetworkSecurityGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_Get.json + */ + /** + * Sample code: Get network security group. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + getNetworkSecurityGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkSecurityGroups() + .getByResourceGroupWithResponse("test-rg", "testnsg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsListByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsListByResourceGroupSamples.java new file mode 100644 index 000000000000..02b64febc944 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for NetworkSecurityGroups ListByResourceGroup. + */ +public final class NetworkSecurityGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_ListByResourceGroup.json + */ + /** + * Sample code: List network security groups in resource group. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void listNetworkSecurityGroupsInResourceGroup( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkSecurityGroups().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsListSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsListSamples.java new file mode 100644 index 000000000000..0c220aaa74a3 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for NetworkSecurityGroups List. + */ +public final class NetworkSecurityGroupsListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_ListAll.json + */ + /** + * Sample code: List all network security groups. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listAllNetworkSecurityGroups(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.networkSecurityGroups().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsUpdateTagsSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsUpdateTagsSamples.java new file mode 100644 index 000000000000..dd5088fcac39 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupsUpdateTagsSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroup; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for NetworkSecurityGroups UpdateTags. + */ +public final class NetworkSecurityGroupsUpdateTagsSamples { + /* + * x-ms-original-file: 2025-06-01-preview/NetworkSecurityGroups_UpdateTags.json + */ + /** + * Sample code: Update network security group tags. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + updateNetworkSecurityGroupTags(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + NetworkSecurityGroup resource = manager.networkSecurityGroups() + .getByResourceGroupWithResponse("testrg", "testnsg", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesCreateOrUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..72a66b0702ed --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesCreateOrUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleAccess; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleDirection; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProtocol; +import java.util.Arrays; + +/** + * Samples for SecurityRules CreateOrUpdate. + */ +public final class SecurityRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/SecurityRules_CreateOrUpdate.json + */ + /** + * Sample code: SecurityRulesCreateOrUpdate. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + securityRulesCreateOrUpdate(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.securityRules() + .define("rule1") + .withExistingNetworkSecurityGroup("testrg", "testnsg") + .withProperties(new SecurityRuleProperties().withProtocol(SecurityRuleProtocol.ASTERISK) + .withSourceAddressPrefixes(Arrays.asList("*")) + .withDestinationAddressPrefixes(Arrays.asList("*")) + .withSourcePortRanges(Arrays.asList("*")) + .withDestinationPortRanges(Arrays.asList("80")) + .withAccess(SecurityRuleAccess.ALLOW) + .withPriority(130) + .withDirection(SecurityRuleDirection.INBOUND)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesDeleteSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesDeleteSamples.java new file mode 100644 index 000000000000..4fa984a49a1e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for SecurityRules Delete. + */ +public final class SecurityRulesDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/SecurityRules_Delete.json + */ + /** + * Sample code: SecurityRulesDelete. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void securityRulesDelete(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.securityRules().delete("testrg", "testnsg", "rule1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesGetSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesGetSamples.java new file mode 100644 index 000000000000..bfcfbf77a870 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for SecurityRules Get. + */ +public final class SecurityRulesGetSamples { + /* + * x-ms-original-file: 2025-06-01-preview/SecurityRules_Get.json + */ + /** + * Sample code: Get network security rule in network security group. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getNetworkSecurityRuleInNetworkSecurityGroup( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.securityRules().getWithResponse("testrg", "testnsg", "rule1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesListByNetworkSecurityGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesListByNetworkSecurityGroupSamples.java new file mode 100644 index 000000000000..0143ee947a05 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesListByNetworkSecurityGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for SecurityRules ListByNetworkSecurityGroup. + */ +public final class SecurityRulesListByNetworkSecurityGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/SecurityRules_ListByNetworkSecurityGroup.json + */ + /** + * Sample code: List network security rules in network security group. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void listNetworkSecurityRulesInNetworkSecurityGroup( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.securityRules().listByNetworkSecurityGroup("testrg", "testnsg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersCreateOrUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersCreateOrUpdateSamples.java new file mode 100644 index 000000000000..613b0b95f73e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersCreateOrUpdateSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerProperties; + +/** + * Samples for StorageContainers CreateOrUpdate. + */ +public final class StorageContainersCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_CreateOrUpdate.json + */ + /** + * Sample code: PutStorageContainer. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putStorageContainer(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.storageContainers() + .define("Default_Container") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withProperties(new StorageContainerProperties().withPath("C:\\container_storage")) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersDeleteSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersDeleteSamples.java new file mode 100644 index 000000000000..4ee0059d1e4d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for StorageContainers Delete. + */ +public final class StorageContainersDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_Delete.json + */ + /** + * Sample code: DeleteStorageContainer. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + deleteStorageContainer(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.storageContainers().delete("test-rg", "Default_Container", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersGetByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersGetByResourceGroupSamples.java new file mode 100644 index 000000000000..de84b5768a6c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for StorageContainers GetByResourceGroup. + */ +public final class StorageContainersGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_Get.json + */ + /** + * Sample code: GetStorageContainer. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getStorageContainer(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.storageContainers() + .getByResourceGroupWithResponse("test-rg", "Default_Container", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersListByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersListByResourceGroupSamples.java new file mode 100644 index 000000000000..73bbf80a4169 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for StorageContainers ListByResourceGroup. + */ +public final class StorageContainersListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_ListByResourceGroup.json + */ + /** + * Sample code: ListStorageContainerByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listStorageContainerByResourceGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.storageContainers().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersListSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersListSamples.java new file mode 100644 index 000000000000..9740795d59d5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for StorageContainers List. + */ +public final class StorageContainersListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_ListAll.json + */ + /** + * Sample code: ListStorageContainerBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listStorageContainerBySubscription(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.storageContainers().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersUpdateSamples.java new file mode 100644 index 000000000000..953022ec937f --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainersUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainer; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageContainers Update. + */ +public final class StorageContainersUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/StorageContainers_Update.json + */ + /** + * Sample code: UpdateStorageContainer. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + updateStorageContainer(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + StorageContainer resource = manager.storageContainers() + .getByResourceGroupWithResponse("test-rg", "Default_Container", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksCreateOrUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a187f8300e09 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksCreateOrUpdateSamples.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskProperties; + +/** + * Samples for VirtualHardDisks CreateOrUpdate. + */ +public final class VirtualHardDisksCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks__CreateOrUpdate_CreateFromLocal.json + */ + /** + * Sample code: CreateVirtualHardDiskFromLocal. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + createVirtualHardDiskFromLocal(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks() + .define("test-vhd") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withProperties(new VirtualHardDiskProperties().withCreateFromLocal(true) + .withContainerId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-storage-container")) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } + + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_CreateOrUpdate.json + */ + /** + * Sample code: PutVirtualHardDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putVirtualHardDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks() + .define("test-vhd") + .withRegion("West US2") + .withExistingResourceGroup("test-rg") + .withProperties(new VirtualHardDiskProperties().withDiskSizeGB(32L)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksDeleteSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksDeleteSamples.java new file mode 100644 index 000000000000..126d01f93bdb --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualHardDisks Delete. + */ +public final class VirtualHardDisksDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_Delete.json + */ + /** + * Sample code: DeleteVirtualHardDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + deleteVirtualHardDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks().delete("test-rg", "test-vhd", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksGetByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksGetByResourceGroupSamples.java new file mode 100644 index 000000000000..2f56369a7c98 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualHardDisks GetByResourceGroup. + */ +public final class VirtualHardDisksGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_Get.json + */ + /** + * Sample code: GetVirtualHardDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void getVirtualHardDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks() + .getByResourceGroupWithResponse("test-rg", "test-vhd", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksListByResourceGroupSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksListByResourceGroupSamples.java new file mode 100644 index 000000000000..0895cdf82a7e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualHardDisks ListByResourceGroup. + */ +public final class VirtualHardDisksListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_ListByResourceGroup.json + */ + /** + * Sample code: ListVirtualHardDiskByResourceGroup. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listVirtualHardDiskByResourceGroup(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks().listByResourceGroup("test-rg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksListSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksListSamples.java new file mode 100644 index 000000000000..012576b79153 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualHardDisks List. + */ +public final class VirtualHardDisksListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_ListAll.json + */ + /** + * Sample code: ListVirtualHardDiskBySubscription. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listVirtualHardDiskBySubscription(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUpdateSamples.java new file mode 100644 index 000000000000..8529b1fc6392 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisk; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for VirtualHardDisks Update. + */ +public final class VirtualHardDisksUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_Update.json + */ + /** + * Sample code: UpdateVirtualHardDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + updateVirtualHardDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + VirtualHardDisk resource = manager.virtualHardDisks() + .getByResourceGroupWithResponse("test-rg", "test-vhd", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("additionalProperties", "sample")).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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUploadSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUploadSamples.java new file mode 100644 index 000000000000..52068dd23e2f --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUploadSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadRequest; + +/** + * Samples for VirtualHardDisks Upload. + */ +public final class VirtualHardDisksUploadSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualHardDisks_Upload.json + */ + /** + * Sample code: UploadVirtualHardDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + uploadVirtualHardDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualHardDisks() + .upload("test-rg", "test-vhd", new VirtualHardDiskUploadRequest().withAzureManagedDiskUploadUrl( + "https://YourStorageAccountName.blob.core.windows.net/YourContainerName/YourVHDBlobName.vhd?"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesCreateOrUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..8cafd99b9464 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesCreateOrUpdateSamples.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.VirtualMachineInstanceInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.GpuAssignmentTypeEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.ImageArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesNetworkProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesOsProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesOsProfileWindowsConfiguration; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesSecurityProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesSecurityProfileUefiSettings; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesStorageProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesStorageProfileOsDisk; +import com.azure.resourcemanager.azurestackhci.vm.models.VmSizeEnum; +import java.util.Arrays; + +/** + * Samples for VirtualMachineInstances CreateOrUpdate. + */ +public final class VirtualMachineInstancesCreateOrUpdateSamples { + /* + * x-ms-original-file: + * 2025-06-01-preview/VirtualMachineInstances_CreateOrUpdate_Put_Virtual_Machine_Instance_With_Gallery_Image.json + */ + /** + * Sample code: PutVirtualMachineInstanceWithGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putVirtualMachineInstanceWithGalleryImage( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner().withProperties(new VirtualMachineInstanceProperties() + .withHardwareProfile( + new VirtualMachineInstancePropertiesHardwareProfile().withVmSize(VmSizeEnum.DEFAULT)) + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withOsProfile( + new VirtualMachineInstancePropertiesOsProfile().withAdminPassword("fakeTokenPlaceholder") + .withAdminUsername("localadmin") + .withComputerName("luamaster")) + .withSecurityProfile(new VirtualMachineInstancePropertiesSecurityProfile().withEnableTPM(true) + .withUefiSettings(new VirtualMachineInstancePropertiesSecurityProfileUefiSettings() + .withSecureBootEnabled(true))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile() + .withImageReference(new ImageArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image")) + .withVmConfigStoragePathId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * 2025-06-01-preview/VirtualMachineInstances_CreateOrUpdate_Put_Virtual_Machine_Instance_With_Os_Disk.json + */ + /** + * Sample code: PutVirtualMachineInstanceWithOsDisk. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + putVirtualMachineInstanceWithOsDisk(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner().withProperties(new VirtualMachineInstanceProperties() + .withHardwareProfile( + new VirtualMachineInstancePropertiesHardwareProfile().withVmSize(VmSizeEnum.DEFAULT)) + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withSecurityProfile(new VirtualMachineInstancePropertiesSecurityProfile().withEnableTPM(true) + .withUefiSettings(new VirtualMachineInstancePropertiesSecurityProfileUefiSettings() + .withSecureBootEnabled(true))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile() + .withOsDisk(new VirtualMachineInstancePropertiesStorageProfileOsDisk().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd")) + .withVmConfigStoragePathId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-06-01-preview/ + * VirtualMachineInstances_CreateOrUpdate_Put_Virtual_Machine_Instance_With_Marketplace_Gallery_Image.json + */ + /** + * Sample code: PutVirtualMachineInstanceWithMarketplaceGalleryImage. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putVirtualMachineInstanceWithMarketplaceGalleryImage( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner().withProperties(new VirtualMachineInstanceProperties() + .withHardwareProfile( + new VirtualMachineInstancePropertiesHardwareProfile().withVmSize(VmSizeEnum.DEFAULT)) + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withOsProfile( + new VirtualMachineInstancePropertiesOsProfile().withAdminPassword("fakeTokenPlaceholder") + .withAdminUsername("localadmin") + .withComputerName("luamaster")) + .withSecurityProfile(new VirtualMachineInstancePropertiesSecurityProfile().withEnableTPM(true) + .withUefiSettings(new VirtualMachineInstancePropertiesSecurityProfileUefiSettings() + .withSecureBootEnabled(true))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile() + .withImageReference(new ImageArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/test-marketplace-gallery-image")) + .withVmConfigStoragePathId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * 2025-06-01-preview/VirtualMachineInstances_CreateOrUpdate_Put_Virtual_Machine_Instance_With_Vm_Config_Agent.json + */ + /** + * Sample code: PutVirtualMachineInstanceWithVMConfigAgent. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void putVirtualMachineInstanceWithVMConfigAgent( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner().withProperties(new VirtualMachineInstanceProperties() + .withHardwareProfile( + new VirtualMachineInstancePropertiesHardwareProfile().withVmSize(VmSizeEnum.DEFAULT)) + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withOsProfile(new VirtualMachineInstancePropertiesOsProfile() + .withAdminPassword("fakeTokenPlaceholder") + .withAdminUsername("localadmin") + .withComputerName("luamaster") + .withWindowsConfiguration(new VirtualMachineInstancePropertiesOsProfileWindowsConfiguration() + .withProvisionVMConfigAgent(true))) + .withSecurityProfile(new VirtualMachineInstancePropertiesSecurityProfile().withEnableTPM(true) + .withUefiSettings(new VirtualMachineInstancePropertiesSecurityProfileUefiSettings() + .withSecureBootEnabled(true))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile() + .withImageReference(new ImageArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image")) + .withVmConfigStoragePathId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * 2025-06-01-preview/VirtualMachineInstances_CreateOrUpdate_Put_Virtual_Machine_Instance_With_Gpu.json + */ + /** + * Sample code: PutVirtualMachineInstanceWithGpu. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + putVirtualMachineInstanceWithGpu(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner() + .withProperties(new VirtualMachineInstanceProperties() + .withHardwareProfile( + new VirtualMachineInstancePropertiesHardwareProfile().withVmSize(VmSizeEnum.DEFAULT) + .withVirtualMachineGPUs(Arrays + .asList(new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPU_DDA) + .withPartitionSizeMB(0L)))) + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withOsProfile( + new VirtualMachineInstancePropertiesOsProfile().withAdminPassword("fakeTokenPlaceholder") + .withAdminUsername("localadmin") + .withComputerName("luamaster")) + .withSecurityProfile(new VirtualMachineInstancePropertiesSecurityProfile() + .withEnableTPM(true) + .withUefiSettings(new VirtualMachineInstancePropertiesSecurityProfileUefiSettings() + .withSecureBootEnabled(true))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile().withImageReference( + new ImageArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/galleryImages/test-gallery-image")) + .withVmConfigStoragePathId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/storageContainers/test-container"))) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances__CreateOrUpdate_CreateFromLocal.json + */ + /** + * Sample code: CreateVirtualMachineInstanceFromLocal. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void createVirtualMachineInstanceFromLocal( + com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .createOrUpdate( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceInner().withProperties(new VirtualMachineInstanceProperties() + .withNetworkProfile(new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.AzureStackHCI/networkInterfaces/test-nic")))) + .withStorageProfile(new VirtualMachineInstancePropertiesStorageProfile() + .withDataDisks(Arrays.asList(new VirtualHardDiskArmReference().withId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd")))) + .withCreateFromLocal(true)) + .withExtendedLocation(new ExtendedLocation().withName( + "/subscriptions/a95612cb-f1fa-4daa-a4fd-272844fa512c/resourceGroups/dogfoodarc/providers/Microsoft.ExtendedLocation/customLocations/dogfood-location") + .withType(ExtendedLocationTypes.CUSTOM_LOCATION)), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesDeleteSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesDeleteSamples.java new file mode 100644 index 000000000000..dd29cacc5bc0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualMachineInstances Delete. + */ +public final class VirtualMachineInstancesDeleteSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Delete.json + */ + /** + * Sample code: DeleteVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void deleteVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .delete( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesGetSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesGetSamples.java new file mode 100644 index 000000000000..983e08da3df4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualMachineInstances Get. + */ +public final class VirtualMachineInstancesGetSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Get.json + */ + /** + * Sample code: GetVirtualMachineInstance. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + getVirtualMachineInstance(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .getWithResponse( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesListSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesListSamples.java new file mode 100644 index 000000000000..f87d4efc327d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualMachineInstances List. + */ +public final class VirtualMachineInstancesListSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_List.json + */ + /** + * Sample code: ListVirtualMachineInstances. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + listVirtualMachineInstances(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .list( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesPauseSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesPauseSamples.java new file mode 100644 index 000000000000..4de52b6151d7 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesPauseSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualMachineInstances Pause. + */ +public final class VirtualMachineInstancesPauseSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Pause.json + */ + /** + * Sample code: PauseVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void pauseVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .pause( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesRestartSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesRestartSamples.java new file mode 100644 index 000000000000..952e6dacd830 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesRestartSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualMachineInstances Restart. + */ +public final class VirtualMachineInstancesRestartSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Restart.json + */ + /** + * Sample code: RestartVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void + restartVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .restart( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesSaveSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesSaveSamples.java new file mode 100644 index 000000000000..8ff134767918 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesSaveSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualMachineInstances Save. + */ +public final class VirtualMachineInstancesSaveSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Save.json + */ + /** + * Sample code: SaveVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void saveVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .save( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesStartSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesStartSamples.java new file mode 100644 index 000000000000..5aabaf0e5ccd --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesStartSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualMachineInstances Start. + */ +public final class VirtualMachineInstancesStartSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Start.json + */ + /** + * Sample code: StartVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void startVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .start( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesStopSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesStopSamples.java new file mode 100644 index 000000000000..c66ee3bbb522 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesStopSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +/** + * Samples for VirtualMachineInstances Stop. + */ +public final class VirtualMachineInstancesStopSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Stop.json + */ + /** + * Sample code: StopVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void stopVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .stop( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesUpdateSamples.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesUpdateSamples.java new file mode 100644 index 000000000000..9434efba03ae --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/samples/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancesUpdateSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.resourcemanager.azurestackhci.vm.models.StorageProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateRequest; +import java.util.Arrays; + +/** + * Samples for VirtualMachineInstances Update. + */ +public final class VirtualMachineInstancesUpdateSamples { + /* + * x-ms-original-file: 2025-06-01-preview/VirtualMachineInstances_Update.json + */ + /** + * Sample code: UpdateVirtualMachine. + * + * @param manager Entry point to AzureStackHciVmManager. + */ + public static void updateVirtualMachine(com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager manager) { + manager.virtualMachineInstances() + .update( + "subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.HybridCompute/machines/DemoVM", + new VirtualMachineInstanceUpdateRequest() + .withProperties(new VirtualMachineInstanceUpdateProperties().withStorageProfile( + new StorageProfileUpdate().withDataDisks(Arrays.asList(new VirtualHardDiskArmReference().withId( + "/subscriptions/fd3c3665-1729-4b7b-9a38-238e83b0f98b/resourceGroups/testrg/providers/Microsoft.AzureStackHCI/virtualHardDisks/test-vhd"))))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusInnerTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusInnerTests.java new file mode 100644 index 000000000000..e5e7dc35c89a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.AttestationStatusInner; + +public final class AttestationStatusInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AttestationStatusInner model = BinaryData.fromString( + "{\"properties\":{\"attestSecureBootEnabled\":\"Disabled\",\"attestationCertValidated\":\"Unknown\",\"bootIntegrityValidated\":\"Valid\",\"linuxKernelVersion\":\"opcjwvnhd\",\"healthStatus\":\"Unhealthy\",\"timestamp\":\"gx\",\"errorMessage\":\"rslpmutwuoeg\",\"provisioningState\":\"Failed\",\"attestHardwarePlatform\":\"SEVSNP\",\"attestDiskSecurityEncryptionType\":\"NonPersistedTPM\"},\"id\":\"yqsluic\",\"name\":\"dggkzzlvmbmpa\",\"type\":\"modfvuefywsbpfvm\"}") + .toObject(AttestationStatusInner.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusPropertiesTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusPropertiesTests.java new file mode 100644 index 000000000000..13d57a50c8de --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusPropertiesTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.AttestationStatusProperties; + +public final class AttestationStatusPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AttestationStatusProperties model = BinaryData.fromString( + "{\"attestSecureBootEnabled\":\"Disabled\",\"attestationCertValidated\":\"Valid\",\"bootIntegrityValidated\":\"Invalid\",\"linuxKernelVersion\":\"ft\",\"healthStatus\":\"Healthy\",\"timestamp\":\"pwiyzvqtm\",\"errorMessage\":\"bexkpzksmondj\",\"provisioningState\":\"Succeeded\",\"attestHardwarePlatform\":\"Unknown\",\"attestDiskSecurityEncryptionType\":\"Unknown\"}") + .toObject(AttestationStatusProperties.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusesGetWithResponseMockTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusesGetWithResponseMockTests.java new file mode 100644 index 000000000000..5bede387c222 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/AttestationStatusesGetWithResponseMockTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager; +import com.azure.resourcemanager.azurestackhci.vm.models.AttestationStatus; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class AttestationStatusesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"attestSecureBootEnabled\":\"Enabled\",\"attestationCertValidated\":\"Invalid\",\"bootIntegrityValidated\":\"Valid\",\"linuxKernelVersion\":\"fgcviz\",\"healthStatus\":\"Pending\",\"timestamp\":\"l\",\"errorMessage\":\"lyoupfgfbkju\",\"provisioningState\":\"Canceled\",\"attestHardwarePlatform\":\"SEVSNP\",\"attestDiskSecurityEncryptionType\":\"Unknown\"},\"id\":\"in\",\"name\":\"g\",\"type\":\"wzf\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureStackHciVmManager manager = AzureStackHciVmManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + AttestationStatus response = manager.attestationStatuses() + .getWithResponse("ksbpimlqoljx", com.azure.core.util.Context.NONE) + .getValue(); + + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/ExtendedLocationTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/ExtendedLocationTests.java new file mode 100644 index 000000000000..646fb9ef30d7 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/ExtendedLocationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import org.junit.jupiter.api.Assertions; + +public final class ExtendedLocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExtendedLocation model = BinaryData.fromString("{\"name\":\"ygjofjdd\",\"type\":\"CustomLocation\"}") + .toObject(ExtendedLocation.class); + Assertions.assertEquals("ygjofjdd", model.name()); + Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExtendedLocation model + = new ExtendedLocation().withName("ygjofjdd").withType(ExtendedLocationTypes.CUSTOM_LOCATION); + model = BinaryData.fromObject(model).toObject(ExtendedLocation.class); + Assertions.assertEquals("ygjofjdd", model.name()); + Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, model.type()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageIdentifierTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageIdentifierTests.java new file mode 100644 index 000000000000..80f66f96b87e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageIdentifierTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageIdentifier; +import org.junit.jupiter.api.Assertions; + +public final class GalleryImageIdentifierTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GalleryImageIdentifier model + = BinaryData.fromString("{\"publisher\":\"foooj\",\"offer\":\"wifsq\",\"sku\":\"saagdf\"}") + .toObject(GalleryImageIdentifier.class); + Assertions.assertEquals("foooj", model.publisher()); + Assertions.assertEquals("wifsq", model.offer()); + Assertions.assertEquals("saagdf", model.sku()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GalleryImageIdentifier model + = new GalleryImageIdentifier().withPublisher("foooj").withOffer("wifsq").withSku("saagdf"); + model = BinaryData.fromObject(model).toObject(GalleryImageIdentifier.class); + Assertions.assertEquals("foooj", model.publisher()); + Assertions.assertEquals("wifsq", model.offer()); + Assertions.assertEquals("saagdf", model.sku()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageStatusDownloadStatusTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageStatusDownloadStatusTests.java new file mode 100644 index 000000000000..adab5280f32d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageStatusDownloadStatusTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageStatusDownloadStatus; +import org.junit.jupiter.api.Assertions; + +public final class GalleryImageStatusDownloadStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GalleryImageStatusDownloadStatus model = BinaryData.fromString("{\"downloadSizeInMB\":6031739459541658820}") + .toObject(GalleryImageStatusDownloadStatus.class); + Assertions.assertEquals(6031739459541658820L, model.downloadSizeInMB()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageStatusProvisioningStatusTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageStatusProvisioningStatusTests.java new file mode 100644 index 000000000000..6168b33ef8d6 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageStatusProvisioningStatusTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageStatusProvisioningStatus; +import com.azure.resourcemanager.azurestackhci.vm.models.Status; +import org.junit.jupiter.api.Assertions; + +public final class GalleryImageStatusProvisioningStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GalleryImageStatusProvisioningStatus model + = BinaryData.fromString("{\"operationId\":\"yf\",\"status\":\"Failed\"}") + .toObject(GalleryImageStatusProvisioningStatus.class); + Assertions.assertEquals("yf", model.operationId()); + Assertions.assertEquals(Status.FAILED, model.status()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageTagsUpdateTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageTagsUpdateTests.java new file mode 100644 index 000000000000..030035a6b71e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageTagsUpdateTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageTagsUpdate; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class GalleryImageTagsUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GalleryImageTagsUpdate model = BinaryData.fromString( + "{\"tags\":{\"flusarhmof\":\"eupewnwreitjz\",\"he\":\"qhsmyurkdtml\",\"rcryuanzwuxzdxta\":\"uksjtxukcdmp\"}}") + .toObject(GalleryImageTagsUpdate.class); + Assertions.assertEquals("eupewnwreitjz", model.tags().get("flusarhmof")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GalleryImageTagsUpdate model = new GalleryImageTagsUpdate() + .withTags(mapOf("flusarhmof", "eupewnwreitjz", "he", "qhsmyurkdtml", "rcryuanzwuxzdxta", "uksjtxukcdmp")); + model = BinaryData.fromObject(model).toObject(GalleryImageTagsUpdate.class); + Assertions.assertEquals("eupewnwreitjz", model.tags().get("flusarhmof")); + } + + // 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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageVersionPropertiesTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageVersionPropertiesTests.java new file mode 100644 index 000000000000..583da64dbb44 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageVersionPropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.GalleryImageVersionProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryOSDiskImage; + +public final class GalleryImageVersionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GalleryImageVersionProperties model + = BinaryData.fromString("{\"storageProfile\":{\"osDiskImage\":{\"sizeInMB\":3662955902041806548}}}") + .toObject(GalleryImageVersionProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GalleryImageVersionProperties model = new GalleryImageVersionProperties() + .withStorageProfile(new GalleryImageVersionStorageProfile().withOsDiskImage(new GalleryOSDiskImage())); + model = BinaryData.fromObject(model).toObject(GalleryImageVersionProperties.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageVersionStorageProfileTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageVersionStorageProfileTests.java new file mode 100644 index 000000000000..53a56b6c2a19 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageVersionStorageProfileTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryOSDiskImage; + +public final class GalleryImageVersionStorageProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GalleryImageVersionStorageProfile model + = BinaryData.fromString("{\"osDiskImage\":{\"sizeInMB\":6890840342903312019}}") + .toObject(GalleryImageVersionStorageProfile.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GalleryImageVersionStorageProfile model + = new GalleryImageVersionStorageProfile().withOsDiskImage(new GalleryOSDiskImage()); + model = BinaryData.fromObject(model).toObject(GalleryImageVersionStorageProfile.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageVersionTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageVersionTests.java new file mode 100644 index 000000000000..86ab5faf41af --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryImageVersionTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageVersion; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryImageVersionStorageProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryOSDiskImage; +import org.junit.jupiter.api.Assertions; + +public final class GalleryImageVersionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GalleryImageVersion model = BinaryData.fromString( + "{\"name\":\"lzl\",\"properties\":{\"storageProfile\":{\"osDiskImage\":{\"sizeInMB\":8500205466841144449}}}}") + .toObject(GalleryImageVersion.class); + Assertions.assertEquals("lzl", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GalleryImageVersion model = new GalleryImageVersion().withName("lzl") + .withStorageProfile(new GalleryImageVersionStorageProfile().withOsDiskImage(new GalleryOSDiskImage())); + model = BinaryData.fromObject(model).toObject(GalleryImageVersion.class); + Assertions.assertEquals("lzl", model.name()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryOSDiskImageTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryOSDiskImageTests.java new file mode 100644 index 000000000000..cb2ee0e042a5 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/GalleryOSDiskImageTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GalleryOSDiskImage; + +public final class GalleryOSDiskImageTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GalleryOSDiskImage model + = BinaryData.fromString("{\"sizeInMB\":6098942127121377639}").toObject(GalleryOSDiskImage.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GalleryOSDiskImage model = new GalleryOSDiskImage(); + model = BinaryData.fromObject(model).toObject(GalleryOSDiskImage.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/HardwareProfileUpdateTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/HardwareProfileUpdateTests.java new file mode 100644 index 000000000000..66fc0c4302a6 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/HardwareProfileUpdateTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GpuAssignmentTypeEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.HardwareProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU; +import com.azure.resourcemanager.azurestackhci.vm.models.VmSizeEnum; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class HardwareProfileUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HardwareProfileUpdate model = BinaryData.fromString( + "{\"vmSize\":\"Standard_DS3_v2\",\"processors\":709641319,\"memoryMB\":4884898065707354513,\"virtualMachineGPUs\":[{\"assignmentType\":\"GpuDDA\",\"partitionSizeMB\":3591916684499053606,\"gpuName\":\"kzgxhurip\"},{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":5090164062241027652,\"gpuName\":\"unkbebx\"},{\"assignmentType\":\"GpuDDA\",\"partitionSizeMB\":5789185793221344217,\"gpuName\":\"twlrbqt\"},{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":9145634763199835148,\"gpuName\":\"eotg\"}]}") + .toObject(HardwareProfileUpdate.class); + Assertions.assertEquals(VmSizeEnum.STANDARD_DS3_V2, model.vmSize()); + Assertions.assertEquals(709641319, model.processors()); + Assertions.assertEquals(4884898065707354513L, model.memoryMB()); + Assertions.assertEquals(GpuAssignmentTypeEnum.GPU_DDA, model.virtualMachineGPUs().get(0).assignmentType()); + Assertions.assertEquals(3591916684499053606L, model.virtualMachineGPUs().get(0).partitionSizeMB()); + Assertions.assertEquals("kzgxhurip", model.virtualMachineGPUs().get(0).gpuName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HardwareProfileUpdate model = new HardwareProfileUpdate().withVmSize(VmSizeEnum.STANDARD_DS3_V2) + .withProcessors(709641319) + .withMemoryMB(4884898065707354513L) + .withVirtualMachineGPUs(Arrays.asList( + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPU_DDA) + .withPartitionSizeMB(3591916684499053606L) + .withGpuName("kzgxhurip"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(5090164062241027652L) + .withGpuName("unkbebx"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPU_DDA) + .withPartitionSizeMB(5789185793221344217L) + .withGpuName("twlrbqt"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(9145634763199835148L) + .withGpuName("eotg"))); + model = BinaryData.fromObject(model).toObject(HardwareProfileUpdate.class); + Assertions.assertEquals(VmSizeEnum.STANDARD_DS3_V2, model.vmSize()); + Assertions.assertEquals(709641319, model.processors()); + Assertions.assertEquals(4884898065707354513L, model.memoryMB()); + Assertions.assertEquals(GpuAssignmentTypeEnum.GPU_DDA, model.virtualMachineGPUs().get(0).assignmentType()); + Assertions.assertEquals(3591916684499053606L, model.virtualMachineGPUs().get(0).partitionSizeMB()); + Assertions.assertEquals("kzgxhurip", model.virtualMachineGPUs().get(0).gpuName()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/HttpProxyConfigurationTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/HttpProxyConfigurationTests.java new file mode 100644 index 000000000000..9bd8cca2f750 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/HttpProxyConfigurationTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.HttpProxyConfiguration; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class HttpProxyConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HttpProxyConfiguration model = BinaryData.fromString( + "{\"httpProxy\":\"gpfqbuace\",\"httpsProxy\":\"zfq\",\"noProxy\":[\"uaopppcqeq\",\"ol\"],\"trustedCa\":\"ahzxctobgbk\"}") + .toObject(HttpProxyConfiguration.class); + Assertions.assertEquals("gpfqbuace", model.httpProxy()); + Assertions.assertEquals("zfq", model.httpsProxy()); + Assertions.assertEquals("uaopppcqeq", model.noProxy().get(0)); + Assertions.assertEquals("ahzxctobgbk", model.trustedCa()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HttpProxyConfiguration model = new HttpProxyConfiguration().withHttpProxy("gpfqbuace") + .withHttpsProxy("zfq") + .withNoProxy(Arrays.asList("uaopppcqeq", "ol")) + .withTrustedCa("ahzxctobgbk"); + model = BinaryData.fromObject(model).toObject(HttpProxyConfiguration.class); + Assertions.assertEquals("gpfqbuace", model.httpProxy()); + Assertions.assertEquals("zfq", model.httpsProxy()); + Assertions.assertEquals("uaopppcqeq", model.noProxy().get(0)); + Assertions.assertEquals("ahzxctobgbk", model.trustedCa()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPConfigurationPropertiesTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPConfigurationPropertiesTests.java new file mode 100644 index 000000000000..90f63779a315 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPConfigurationPropertiesTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.IPConfigurationProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkArmReference; +import org.junit.jupiter.api.Assertions; + +public final class IPConfigurationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IPConfigurationProperties model = BinaryData.fromString( + "{\"gateway\":\"uwiqzb\",\"prefixLength\":\"vsovmyokac\",\"privateIPAddress\":\"kwlhzdo\",\"subnet\":{\"id\":\"jmflbvvnch\"}}") + .toObject(IPConfigurationProperties.class); + Assertions.assertEquals("kwlhzdo", model.privateIPAddress()); + Assertions.assertEquals("jmflbvvnch", model.subnet().id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IPConfigurationProperties model = new IPConfigurationProperties().withPrivateIPAddress("kwlhzdo") + .withSubnet(new LogicalNetworkArmReference().withId("jmflbvvnch")); + model = BinaryData.fromObject(model).toObject(IPConfigurationProperties.class); + Assertions.assertEquals("kwlhzdo", model.privateIPAddress()); + Assertions.assertEquals("jmflbvvnch", model.subnet().id()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPConfigurationTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPConfigurationTests.java new file mode 100644 index 000000000000..489c1e56efd4 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPConfigurationTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.IPConfiguration; +import com.azure.resourcemanager.azurestackhci.vm.models.IPConfigurationProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkArmReference; +import org.junit.jupiter.api.Assertions; + +public final class IPConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IPConfiguration model = BinaryData.fromString( + "{\"name\":\"udxorrqn\",\"properties\":{\"gateway\":\"czvyifq\",\"prefixLength\":\"kdvjsll\",\"privateIPAddress\":\"vvdfwatkpnpul\",\"subnet\":{\"id\":\"bczw\"}}}") + .toObject(IPConfiguration.class); + Assertions.assertEquals("udxorrqn", model.name()); + Assertions.assertEquals("vvdfwatkpnpul", model.properties().privateIPAddress()); + Assertions.assertEquals("bczw", model.properties().subnet().id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IPConfiguration model = new IPConfiguration().withName("udxorrqn") + .withProperties(new IPConfigurationProperties().withPrivateIPAddress("vvdfwatkpnpul") + .withSubnet(new LogicalNetworkArmReference().withId("bczw"))); + model = BinaryData.fromObject(model).toObject(IPConfiguration.class); + Assertions.assertEquals("udxorrqn", model.name()); + Assertions.assertEquals("vvdfwatkpnpul", model.properties().privateIPAddress()); + Assertions.assertEquals("bczw", model.properties().subnet().id()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPPoolInfoTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPPoolInfoTests.java new file mode 100644 index 000000000000..c10faade1374 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPPoolInfoTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.IPPoolInfo; + +public final class IPPoolInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IPPoolInfo model + = BinaryData.fromString("{\"used\":\"wndeicbtwnp\",\"available\":\"oqvuhr\"}").toObject(IPPoolInfo.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IPPoolInfo model = new IPPoolInfo(); + model = BinaryData.fromObject(model).toObject(IPPoolInfo.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPPoolTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPPoolTests.java new file mode 100644 index 000000000000..365f0842e1bd --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IPPoolTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.IPPool; +import com.azure.resourcemanager.azurestackhci.vm.models.IPPoolInfo; +import com.azure.resourcemanager.azurestackhci.vm.models.IPPoolTypeEnum; +import org.junit.jupiter.api.Assertions; + +public final class IPPoolTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IPPool model = BinaryData.fromString( + "{\"name\":\"kbfkg\",\"ipPoolType\":\"vippool\",\"start\":\"exxppofmxaxcfjp\",\"end\":\"dtocj\",\"info\":{\"used\":\"vpmouexhdzxib\",\"available\":\"ojnxqbzvdd\"}}") + .toObject(IPPool.class); + Assertions.assertEquals("kbfkg", model.name()); + Assertions.assertEquals(IPPoolTypeEnum.VIPPOOL, model.ipPoolType()); + Assertions.assertEquals("exxppofmxaxcfjp", model.start()); + Assertions.assertEquals("dtocj", model.end()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IPPool model = new IPPool().withName("kbfkg") + .withIpPoolType(IPPoolTypeEnum.VIPPOOL) + .withStart("exxppofmxaxcfjp") + .withEnd("dtocj") + .withInfo(new IPPoolInfo()); + model = BinaryData.fromObject(model).toObject(IPPool.class); + Assertions.assertEquals("kbfkg", model.name()); + Assertions.assertEquals(IPPoolTypeEnum.VIPPOOL, model.ipPoolType()); + Assertions.assertEquals("exxppofmxaxcfjp", model.start()); + Assertions.assertEquals("dtocj", model.end()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IdentityTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IdentityTests.java new file mode 100644 index 000000000000..6425a50b04b7 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/IdentityTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.Identity; +import com.azure.resourcemanager.azurestackhci.vm.models.IdentityType; +import org.junit.jupiter.api.Assertions; + +public final class IdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Identity model = BinaryData + .fromString("{\"principalId\":\"gohdneuelfphsd\",\"tenantId\":\"t\",\"type\":\"SystemAssigned\"}") + .toObject(Identity.class); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Identity model = new Identity().withType(IdentityType.SYSTEM_ASSIGNED); + model = BinaryData.fromObject(model).toObject(Identity.class); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.type()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/ImageArmReferenceTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/ImageArmReferenceTests.java new file mode 100644 index 000000000000..dfe75919a145 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/ImageArmReferenceTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.ImageArmReference; +import org.junit.jupiter.api.Assertions; + +public final class ImageArmReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ImageArmReference model = BinaryData.fromString("{\"id\":\"hxg\"}").toObject(ImageArmReference.class); + Assertions.assertEquals("hxg", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ImageArmReference model = new ImageArmReference().withId("hxg"); + model = BinaryData.fromObject(model).toObject(ImageArmReference.class); + Assertions.assertEquals("hxg", model.id()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/InterfaceDNSSettingsTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/InterfaceDNSSettingsTests.java new file mode 100644 index 000000000000..37eb66ece329 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/InterfaceDNSSettingsTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.InterfaceDNSSettings; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class InterfaceDNSSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InterfaceDNSSettings model + = BinaryData.fromString("{\"dnsServers\":[\"uqkhrsajiwku\"]}").toObject(InterfaceDNSSettings.class); + Assertions.assertEquals("uqkhrsajiwku", model.dnsServers().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InterfaceDNSSettings model = new InterfaceDNSSettings().withDnsServers(Arrays.asList("uqkhrsajiwku")); + model = BinaryData.fromObject(model).toObject(InterfaceDNSSettings.class); + Assertions.assertEquals("uqkhrsajiwku", model.dnsServers().get(0)); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworkArmReferenceTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworkArmReferenceTests.java new file mode 100644 index 000000000000..4744587446c2 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworkArmReferenceTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkArmReference; +import org.junit.jupiter.api.Assertions; + +public final class LogicalNetworkArmReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogicalNetworkArmReference model + = BinaryData.fromString("{\"id\":\"cciw\"}").toObject(LogicalNetworkArmReference.class); + Assertions.assertEquals("cciw", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogicalNetworkArmReference model = new LogicalNetworkArmReference().withId("cciw"); + model = BinaryData.fromObject(model).toObject(LogicalNetworkArmReference.class); + Assertions.assertEquals("cciw", model.id()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworkPropertiesDhcpOptionsTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworkPropertiesDhcpOptionsTests.java new file mode 100644 index 000000000000..3956b8a40417 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworkPropertiesDhcpOptionsTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkPropertiesDhcpOptions; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class LogicalNetworkPropertiesDhcpOptionsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogicalNetworkPropertiesDhcpOptions model = BinaryData.fromString("{\"dnsServers\":[\"tusivyevcciqihn\"]}") + .toObject(LogicalNetworkPropertiesDhcpOptions.class); + Assertions.assertEquals("tusivyevcciqihn", model.dnsServers().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogicalNetworkPropertiesDhcpOptions model + = new LogicalNetworkPropertiesDhcpOptions().withDnsServers(Arrays.asList("tusivyevcciqihn")); + model = BinaryData.fromObject(model).toObject(LogicalNetworkPropertiesDhcpOptions.class); + Assertions.assertEquals("tusivyevcciqihn", model.dnsServers().get(0)); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworkStatusProvisioningStatusTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworkStatusProvisioningStatusTests.java new file mode 100644 index 000000000000..ea849a8610cd --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworkStatusProvisioningStatusTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworkStatusProvisioningStatus; +import com.azure.resourcemanager.azurestackhci.vm.models.Status; +import org.junit.jupiter.api.Assertions; + +public final class LogicalNetworkStatusProvisioningStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogicalNetworkStatusProvisioningStatus model + = BinaryData.fromString("{\"operationId\":\"yd\",\"status\":\"Succeeded\"}") + .toObject(LogicalNetworkStatusProvisioningStatus.class); + Assertions.assertEquals("yd", model.operationId()); + Assertions.assertEquals(Status.SUCCEEDED, model.status()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksUpdateRequestTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksUpdateRequestTests.java new file mode 100644 index 000000000000..7184658c68c0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/LogicalNetworksUpdateRequestTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.LogicalNetworksUpdateRequest; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class LogicalNetworksUpdateRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogicalNetworksUpdateRequest model + = BinaryData.fromString("{\"tags\":{\"jqkwpyeicx\":\"t\",\"pbobjo\":\"qciwqvhkhixuigdt\",\"w\":\"hm\"}}") + .toObject(LogicalNetworksUpdateRequest.class); + Assertions.assertEquals("t", model.tags().get("jqkwpyeicx")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogicalNetworksUpdateRequest model = new LogicalNetworksUpdateRequest() + .withTags(mapOf("jqkwpyeicx", "t", "pbobjo", "qciwqvhkhixuigdt", "w", "hm")); + model = BinaryData.fromObject(model).toObject(LogicalNetworksUpdateRequest.class); + Assertions.assertEquals("t", model.tags().get("jqkwpyeicx")); + } + + // 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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/ManagedServiceIdentityTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/ManagedServiceIdentityTests.java new file mode 100644 index 000000000000..149a300aa71a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.ManagedServiceIdentity; +import com.azure.resourcemanager.azurestackhci.vm.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.azurestackhci.vm.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = BinaryData.fromString( + "{\"principalId\":\"pe\",\"tenantId\":\"wfbkrvrns\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"hsqfsubcgjbirxbp\":{\"principalId\":\"ohxcrsbfova\",\"clientId\":\"ruvw\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("hsqfsubcgjbirxbp", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImageStatusDownloadStatusTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImageStatusDownloadStatusTests.java new file mode 100644 index 000000000000..ce321c3b6ca0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImageStatusDownloadStatusTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageStatusDownloadStatus; +import org.junit.jupiter.api.Assertions; + +public final class MarketplaceGalleryImageStatusDownloadStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MarketplaceGalleryImageStatusDownloadStatus model + = BinaryData.fromString("{\"downloadSizeInMB\":5538754849059417919}") + .toObject(MarketplaceGalleryImageStatusDownloadStatus.class); + Assertions.assertEquals(5538754849059417919L, model.downloadSizeInMB()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImageStatusProvisioningStatusTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImageStatusProvisioningStatusTests.java new file mode 100644 index 000000000000..7aaa1fca8f86 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImageStatusProvisioningStatusTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageStatusProvisioningStatus; +import com.azure.resourcemanager.azurestackhci.vm.models.Status; +import org.junit.jupiter.api.Assertions; + +public final class MarketplaceGalleryImageStatusProvisioningStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MarketplaceGalleryImageStatusProvisioningStatus model + = BinaryData.fromString("{\"operationId\":\"nj\",\"status\":\"Succeeded\"}") + .toObject(MarketplaceGalleryImageStatusProvisioningStatus.class); + Assertions.assertEquals("nj", model.operationId()); + Assertions.assertEquals(Status.SUCCEEDED, model.status()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImageTagsUpdateTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImageTagsUpdateTests.java new file mode 100644 index 000000000000..2c0d49b095dd --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/MarketplaceGalleryImageTagsUpdateTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.MarketplaceGalleryImageTagsUpdate; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MarketplaceGalleryImageTagsUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MarketplaceGalleryImageTagsUpdate model = BinaryData.fromString( + "{\"tags\":{\"yegu\":\"pdjpjumasxazjp\",\"wdslfhotwmcy\":\"lhbxxhejjzzvdud\",\"cftadeh\":\"pwlbjnpg\"}}") + .toObject(MarketplaceGalleryImageTagsUpdate.class); + Assertions.assertEquals("pdjpjumasxazjp", model.tags().get("yegu")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MarketplaceGalleryImageTagsUpdate model = new MarketplaceGalleryImageTagsUpdate() + .withTags(mapOf("yegu", "pdjpjumasxazjp", "wdslfhotwmcy", "lhbxxhejjzzvdud", "cftadeh", "pwlbjnpg")); + model = BinaryData.fromObject(model).toObject(MarketplaceGalleryImageTagsUpdate.class); + Assertions.assertEquals("pdjpjumasxazjp", model.tags().get("yegu")); + } + + // 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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfaceArmReferenceTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfaceArmReferenceTests.java new file mode 100644 index 000000000000..842461c0b8cb --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfaceArmReferenceTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceArmReference; +import org.junit.jupiter.api.Assertions; + +public final class NetworkInterfaceArmReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkInterfaceArmReference model + = BinaryData.fromString("{\"id\":\"tcxsenhwlrs\"}").toObject(NetworkInterfaceArmReference.class); + Assertions.assertEquals("tcxsenhwlrs", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkInterfaceArmReference model = new NetworkInterfaceArmReference().withId("tcxsenhwlrs"); + model = BinaryData.fromObject(model).toObject(NetworkInterfaceArmReference.class); + Assertions.assertEquals("tcxsenhwlrs", model.id()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfaceStatusProvisioningStatusTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfaceStatusProvisioningStatusTests.java new file mode 100644 index 000000000000..d740b4e10421 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfaceStatusProvisioningStatusTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceStatusProvisioningStatus; +import com.azure.resourcemanager.azurestackhci.vm.models.Status; +import org.junit.jupiter.api.Assertions; + +public final class NetworkInterfaceStatusProvisioningStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkInterfaceStatusProvisioningStatus model + = BinaryData.fromString("{\"operationId\":\"auu\",\"status\":\"InProgress\"}") + .toObject(NetworkInterfaceStatusProvisioningStatus.class); + Assertions.assertEquals("auu", model.operationId()); + Assertions.assertEquals(Status.IN_PROGRESS, model.status()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesUpdatePropertiesTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesUpdatePropertiesTests.java new file mode 100644 index 000000000000..ac20f4a97e29 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesUpdatePropertiesTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.InterfaceDNSSettings; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfacesUpdateProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupArmReference; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class NetworkInterfacesUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkInterfacesUpdateProperties model = BinaryData.fromString( + "{\"networkSecurityGroup\":{\"id\":\"vmezy\"},\"dnsSettings\":{\"dnsServers\":[\"mzsb\",\"zoggigrxwburvjxx\",\"nspydptkoenkoukn\"]}}") + .toObject(NetworkInterfacesUpdateProperties.class); + Assertions.assertEquals("vmezy", model.networkSecurityGroup().id()); + Assertions.assertEquals("mzsb", model.dnsSettings().dnsServers().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkInterfacesUpdateProperties model = new NetworkInterfacesUpdateProperties() + .withNetworkSecurityGroup(new NetworkSecurityGroupArmReference().withId("vmezy")) + .withDnsSettings(new InterfaceDNSSettings() + .withDnsServers(Arrays.asList("mzsb", "zoggigrxwburvjxx", "nspydptkoenkoukn"))); + model = BinaryData.fromObject(model).toObject(NetworkInterfacesUpdateProperties.class); + Assertions.assertEquals("vmezy", model.networkSecurityGroup().id()); + Assertions.assertEquals("mzsb", model.dnsSettings().dnsServers().get(0)); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesUpdateRequestTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesUpdateRequestTests.java new file mode 100644 index 000000000000..555a99291002 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkInterfacesUpdateRequestTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.InterfaceDNSSettings; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfacesUpdateProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfacesUpdateRequest; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupArmReference; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class NetworkInterfacesUpdateRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkInterfacesUpdateRequest model = BinaryData.fromString( + "{\"tags\":{\"byao\":\"xieduugidyjrr\",\"xc\":\"v\",\"hocohslkev\":\"onpc\"},\"properties\":{\"networkSecurityGroup\":{\"id\":\"zfbuhf\"},\"dnsSettings\":{\"dnsServers\":[\"x\",\"ffeii\"]}}}") + .toObject(NetworkInterfacesUpdateRequest.class); + Assertions.assertEquals("xieduugidyjrr", model.tags().get("byao")); + Assertions.assertEquals("zfbuhf", model.properties().networkSecurityGroup().id()); + Assertions.assertEquals("x", model.properties().dnsSettings().dnsServers().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkInterfacesUpdateRequest model = new NetworkInterfacesUpdateRequest() + .withTags(mapOf("byao", "xieduugidyjrr", "xc", "v", "hocohslkev", "onpc")) + .withProperties(new NetworkInterfacesUpdateProperties() + .withNetworkSecurityGroup(new NetworkSecurityGroupArmReference().withId("zfbuhf")) + .withDnsSettings(new InterfaceDNSSettings().withDnsServers(Arrays.asList("x", "ffeii")))); + model = BinaryData.fromObject(model).toObject(NetworkInterfacesUpdateRequest.class); + Assertions.assertEquals("xieduugidyjrr", model.tags().get("byao")); + Assertions.assertEquals("zfbuhf", model.properties().networkSecurityGroup().id()); + Assertions.assertEquals("x", model.properties().dnsSettings().dnsServers().get(0)); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkProfileUpdateTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkProfileUpdateTests.java new file mode 100644 index 000000000000..05557c067b5a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkProfileUpdateTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkProfileUpdate; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class NetworkProfileUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkProfileUpdate model = BinaryData.fromString("{\"networkInterfaces\":[{\"id\":\"pgcjefuzmuvp\"}]}") + .toObject(NetworkProfileUpdate.class); + Assertions.assertEquals("pgcjefuzmuvp", model.networkInterfaces().get(0).id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkProfileUpdate model = new NetworkProfileUpdate() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId("pgcjefuzmuvp"))); + model = BinaryData.fromObject(model).toObject(NetworkProfileUpdate.class); + Assertions.assertEquals("pgcjefuzmuvp", model.networkInterfaces().get(0).id()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupArmReferenceTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupArmReferenceTests.java new file mode 100644 index 000000000000..3c0fa7b6e110 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupArmReferenceTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupArmReference; +import org.junit.jupiter.api.Assertions; + +public final class NetworkSecurityGroupArmReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkSecurityGroupArmReference model + = BinaryData.fromString("{\"id\":\"nohjt\"}").toObject(NetworkSecurityGroupArmReference.class); + Assertions.assertEquals("nohjt", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkSecurityGroupArmReference model = new NetworkSecurityGroupArmReference().withId("nohjt"); + model = BinaryData.fromObject(model).toObject(NetworkSecurityGroupArmReference.class); + Assertions.assertEquals("nohjt", model.id()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupStatusProvisioningStatusTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupStatusProvisioningStatusTests.java new file mode 100644 index 000000000000..10b2ba7349b2 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupStatusProvisioningStatusTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupStatusProvisioningStatus; +import com.azure.resourcemanager.azurestackhci.vm.models.Status; +import org.junit.jupiter.api.Assertions; + +public final class NetworkSecurityGroupStatusProvisioningStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkSecurityGroupStatusProvisioningStatus model + = BinaryData.fromString("{\"operationId\":\"ihkaetcktvfc\",\"status\":\"Failed\"}") + .toObject(NetworkSecurityGroupStatusProvisioningStatus.class); + Assertions.assertEquals("ihkaetcktvfc", model.operationId()); + Assertions.assertEquals(Status.FAILED, model.status()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupTagsUpdateTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupTagsUpdateTests.java new file mode 100644 index 000000000000..98b2a83cb961 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/NetworkSecurityGroupTagsUpdateTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupTagsUpdate; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class NetworkSecurityGroupTagsUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NetworkSecurityGroupTagsUpdate model = BinaryData.fromString( + "{\"tags\":{\"cxerf\":\"kymuctqhjfbebr\",\"phxepcyvahf\":\"wutttxfvjrbi\",\"gidokgjljyoxgvcl\":\"ljkyqxjvuuj\",\"jhtxfvgxbfsmxne\":\"bgsncghkjeszzhb\"}}") + .toObject(NetworkSecurityGroupTagsUpdate.class); + Assertions.assertEquals("kymuctqhjfbebr", model.tags().get("cxerf")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NetworkSecurityGroupTagsUpdate model + = new NetworkSecurityGroupTagsUpdate().withTags(mapOf("cxerf", "kymuctqhjfbebr", "phxepcyvahf", + "wutttxfvjrbi", "gidokgjljyoxgvcl", "ljkyqxjvuuj", "jhtxfvgxbfsmxne", "bgsncghkjeszzhb")); + model = BinaryData.fromObject(model).toObject(NetworkSecurityGroupTagsUpdate.class); + Assertions.assertEquals("kymuctqhjfbebr", model.tags().get("cxerf")); + } + + // 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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/OsProfileUpdateLinuxConfigurationTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/OsProfileUpdateLinuxConfigurationTests.java new file mode 100644 index 000000000000..e6e148c8faf7 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/OsProfileUpdateLinuxConfigurationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateLinuxConfiguration; +import org.junit.jupiter.api.Assertions; + +public final class OsProfileUpdateLinuxConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OsProfileUpdateLinuxConfiguration model + = BinaryData.fromString("{\"provisionVMAgent\":true,\"provisionVMConfigAgent\":true}") + .toObject(OsProfileUpdateLinuxConfiguration.class); + Assertions.assertTrue(model.provisionVMAgent()); + Assertions.assertTrue(model.provisionVMConfigAgent()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OsProfileUpdateLinuxConfiguration model + = new OsProfileUpdateLinuxConfiguration().withProvisionVMAgent(true).withProvisionVMConfigAgent(true); + model = BinaryData.fromObject(model).toObject(OsProfileUpdateLinuxConfiguration.class); + Assertions.assertTrue(model.provisionVMAgent()); + Assertions.assertTrue(model.provisionVMConfigAgent()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/OsProfileUpdateTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/OsProfileUpdateTests.java new file mode 100644 index 000000000000..b916bef52146 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/OsProfileUpdateTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateLinuxConfiguration; +import com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateWindowsConfiguration; +import org.junit.jupiter.api.Assertions; + +public final class OsProfileUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OsProfileUpdate model = BinaryData.fromString( + "{\"computerName\":\"tdum\",\"linuxConfiguration\":{\"provisionVMAgent\":true,\"provisionVMConfigAgent\":true},\"windowsConfiguration\":{\"provisionVMAgent\":false,\"provisionVMConfigAgent\":true}}") + .toObject(OsProfileUpdate.class); + Assertions.assertEquals("tdum", model.computerName()); + Assertions.assertTrue(model.linuxConfiguration().provisionVMAgent()); + Assertions.assertTrue(model.linuxConfiguration().provisionVMConfigAgent()); + Assertions.assertFalse(model.windowsConfiguration().provisionVMAgent()); + Assertions.assertTrue(model.windowsConfiguration().provisionVMConfigAgent()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OsProfileUpdate model = new OsProfileUpdate().withComputerName("tdum") + .withLinuxConfiguration( + new OsProfileUpdateLinuxConfiguration().withProvisionVMAgent(true).withProvisionVMConfigAgent(true)) + .withWindowsConfiguration( + new OsProfileUpdateWindowsConfiguration().withProvisionVMAgent(false).withProvisionVMConfigAgent(true)); + model = BinaryData.fromObject(model).toObject(OsProfileUpdate.class); + Assertions.assertEquals("tdum", model.computerName()); + Assertions.assertTrue(model.linuxConfiguration().provisionVMAgent()); + Assertions.assertTrue(model.linuxConfiguration().provisionVMConfigAgent()); + Assertions.assertFalse(model.windowsConfiguration().provisionVMAgent()); + Assertions.assertTrue(model.windowsConfiguration().provisionVMConfigAgent()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/OsProfileUpdateWindowsConfigurationTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/OsProfileUpdateWindowsConfigurationTests.java new file mode 100644 index 000000000000..66ab352d0139 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/OsProfileUpdateWindowsConfigurationTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateWindowsConfiguration; +import org.junit.jupiter.api.Assertions; + +public final class OsProfileUpdateWindowsConfigurationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OsProfileUpdateWindowsConfiguration model + = BinaryData.fromString("{\"provisionVMAgent\":false,\"provisionVMConfigAgent\":true}") + .toObject(OsProfileUpdateWindowsConfiguration.class); + Assertions.assertFalse(model.provisionVMAgent()); + Assertions.assertTrue(model.provisionVMConfigAgent()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OsProfileUpdateWindowsConfiguration model + = new OsProfileUpdateWindowsConfiguration().withProvisionVMAgent(false).withProvisionVMConfigAgent(true); + model = BinaryData.fromObject(model).toObject(OsProfileUpdateWindowsConfiguration.class); + Assertions.assertFalse(model.provisionVMAgent()); + Assertions.assertTrue(model.provisionVMConfigAgent()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RoutePropertiesTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RoutePropertiesTests.java new file mode 100644 index 000000000000..f770b3e611c2 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RoutePropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.RouteProperties; +import org.junit.jupiter.api.Assertions; + +public final class RoutePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RouteProperties model + = BinaryData.fromString("{\"addressPrefix\":\"ijcoejctb\",\"nextHopIpAddress\":\"qsqsy\"}") + .toObject(RouteProperties.class); + Assertions.assertEquals("ijcoejctb", model.addressPrefix()); + Assertions.assertEquals("qsqsy", model.nextHopIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RouteProperties model = new RouteProperties().withAddressPrefix("ijcoejctb").withNextHopIpAddress("qsqsy"); + model = BinaryData.fromObject(model).toObject(RouteProperties.class); + Assertions.assertEquals("ijcoejctb", model.addressPrefix()); + Assertions.assertEquals("qsqsy", model.nextHopIpAddress()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RouteTablePropertiesTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RouteTablePropertiesTests.java new file mode 100644 index 000000000000..7542527509ac --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RouteTablePropertiesTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.RouteTableProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.Route; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RouteTablePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RouteTableProperties model = BinaryData.fromString( + "{\"routes\":[{\"properties\":{\"addressPrefix\":\"qcjm\",\"nextHopIpAddress\":\"javbqidtqajz\"},\"name\":\"l\"},{\"properties\":{\"addressPrefix\":\"dj\",\"nextHopIpAddress\":\"lkhbz\"},\"name\":\"epgzgqexz\"},{\"properties\":{\"addressPrefix\":\"xscpaierhhbc\",\"nextHopIpAddress\":\"l\"},\"name\":\"majtjaod\"},{\"properties\":{\"addressPrefix\":\"nbdxk\",\"nextHopIpAddress\":\"xo\"},\"name\":\"jionpimexgstxgc\"}]}") + .toObject(RouteTableProperties.class); + Assertions.assertEquals("l", model.routes().get(0).name()); + Assertions.assertEquals("qcjm", model.routes().get(0).addressPrefix()); + Assertions.assertEquals("javbqidtqajz", model.routes().get(0).nextHopIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RouteTableProperties model = new RouteTableProperties().withRoutes( + Arrays.asList(new Route().withName("l").withAddressPrefix("qcjm").withNextHopIpAddress("javbqidtqajz"), + new Route().withName("epgzgqexz").withAddressPrefix("dj").withNextHopIpAddress("lkhbz"), + new Route().withName("majtjaod").withAddressPrefix("xscpaierhhbc").withNextHopIpAddress("l"), + new Route().withName("jionpimexgstxgc").withAddressPrefix("nbdxk").withNextHopIpAddress("xo"))); + model = BinaryData.fromObject(model).toObject(RouteTableProperties.class); + Assertions.assertEquals("l", model.routes().get(0).name()); + Assertions.assertEquals("qcjm", model.routes().get(0).addressPrefix()); + Assertions.assertEquals("javbqidtqajz", model.routes().get(0).nextHopIpAddress()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RouteTableTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RouteTableTests.java new file mode 100644 index 000000000000..09c77f9d429c --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RouteTableTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.Route; +import com.azure.resourcemanager.azurestackhci.vm.models.RouteTable; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RouteTableTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RouteTable model = BinaryData.fromString( + "{\"etag\":\"whdsoifiyip\",\"name\":\"sqwpgrjb\",\"type\":\"orcjxvsnby\",\"properties\":{\"routes\":[{\"properties\":{\"addressPrefix\":\"ocpcy\",\"nextHopIpAddress\":\"urzafb\"},\"name\":\"j\"}]}}") + .toObject(RouteTable.class); + Assertions.assertEquals("j", model.routes().get(0).name()); + Assertions.assertEquals("ocpcy", model.routes().get(0).addressPrefix()); + Assertions.assertEquals("urzafb", model.routes().get(0).nextHopIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RouteTable model = new RouteTable().withRoutes( + Arrays.asList(new Route().withName("j").withAddressPrefix("ocpcy").withNextHopIpAddress("urzafb"))); + model = BinaryData.fromObject(model).toObject(RouteTable.class); + Assertions.assertEquals("j", model.routes().get(0).name()); + Assertions.assertEquals("ocpcy", model.routes().get(0).addressPrefix()); + Assertions.assertEquals("urzafb", model.routes().get(0).nextHopIpAddress()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RouteTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RouteTests.java new file mode 100644 index 000000000000..18c71e830c84 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/RouteTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.Route; +import org.junit.jupiter.api.Assertions; + +public final class RouteTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Route model = BinaryData + .fromString( + "{\"properties\":{\"addressPrefix\":\"gmaajrm\",\"nextHopIpAddress\":\"jwzrl\"},\"name\":\"mcl\"}") + .toObject(Route.class); + Assertions.assertEquals("mcl", model.name()); + Assertions.assertEquals("gmaajrm", model.addressPrefix()); + Assertions.assertEquals("jwzrl", model.nextHopIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Route model = new Route().withName("mcl").withAddressPrefix("gmaajrm").withNextHopIpAddress("jwzrl"); + model = BinaryData.fromObject(model).toObject(Route.class); + Assertions.assertEquals("mcl", model.name()); + Assertions.assertEquals("gmaajrm", model.addressPrefix()); + Assertions.assertEquals("jwzrl", model.nextHopIpAddress()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRuleInnerTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRuleInnerTests.java new file mode 100644 index 000000000000..f23a9f85bed6 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRuleInnerTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.SecurityRuleInner; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleAccess; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleDirection; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProtocol; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SecurityRuleInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SecurityRuleInner model = BinaryData.fromString( + "{\"properties\":{\"description\":\"ahmgkbrp\",\"protocol\":\"Tcp\",\"sourceAddressPrefixes\":[\"ibnuqqkpik\",\"drgvtqagn\",\"uynhijg\"],\"destinationAddressPrefixes\":[\"bfs\"],\"sourcePortRanges\":[\"butr\"],\"destinationPortRanges\":[\"na\",\"zmhjrunmp\"],\"access\":\"Deny\",\"priority\":18555434,\"direction\":\"Outbound\",\"provisioningState\":\"Failed\"},\"extendedLocation\":{\"name\":\"nlankxmyskpb\",\"type\":\"CustomLocation\"},\"id\":\"tkcxywnytnrsy\",\"name\":\"lqidyby\",\"type\":\"czfc\"}") + .toObject(SecurityRuleInner.class); + Assertions.assertEquals("ahmgkbrp", model.properties().description()); + Assertions.assertEquals(SecurityRuleProtocol.TCP, model.properties().protocol()); + Assertions.assertEquals("ibnuqqkpik", model.properties().sourceAddressPrefixes().get(0)); + Assertions.assertEquals("bfs", model.properties().destinationAddressPrefixes().get(0)); + Assertions.assertEquals("butr", model.properties().sourcePortRanges().get(0)); + Assertions.assertEquals("na", model.properties().destinationPortRanges().get(0)); + Assertions.assertEquals(SecurityRuleAccess.DENY, model.properties().access()); + Assertions.assertEquals(18555434, model.properties().priority()); + Assertions.assertEquals(SecurityRuleDirection.OUTBOUND, model.properties().direction()); + Assertions.assertEquals("nlankxmyskpb", model.extendedLocation().name()); + Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, model.extendedLocation().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SecurityRuleInner model = new SecurityRuleInner() + .withProperties(new SecurityRuleProperties().withDescription("ahmgkbrp") + .withProtocol(SecurityRuleProtocol.TCP) + .withSourceAddressPrefixes(Arrays.asList("ibnuqqkpik", "drgvtqagn", "uynhijg")) + .withDestinationAddressPrefixes(Arrays.asList("bfs")) + .withSourcePortRanges(Arrays.asList("butr")) + .withDestinationPortRanges(Arrays.asList("na", "zmhjrunmp")) + .withAccess(SecurityRuleAccess.DENY) + .withPriority(18555434) + .withDirection(SecurityRuleDirection.OUTBOUND)) + .withExtendedLocation( + new ExtendedLocation().withName("nlankxmyskpb").withType(ExtendedLocationTypes.CUSTOM_LOCATION)); + model = BinaryData.fromObject(model).toObject(SecurityRuleInner.class); + Assertions.assertEquals("ahmgkbrp", model.properties().description()); + Assertions.assertEquals(SecurityRuleProtocol.TCP, model.properties().protocol()); + Assertions.assertEquals("ibnuqqkpik", model.properties().sourceAddressPrefixes().get(0)); + Assertions.assertEquals("bfs", model.properties().destinationAddressPrefixes().get(0)); + Assertions.assertEquals("butr", model.properties().sourcePortRanges().get(0)); + Assertions.assertEquals("na", model.properties().destinationPortRanges().get(0)); + Assertions.assertEquals(SecurityRuleAccess.DENY, model.properties().access()); + Assertions.assertEquals(18555434, model.properties().priority()); + Assertions.assertEquals(SecurityRuleDirection.OUTBOUND, model.properties().direction()); + Assertions.assertEquals("nlankxmyskpb", model.extendedLocation().name()); + Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, model.extendedLocation().type()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRuleListResultTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRuleListResultTests.java new file mode 100644 index 000000000000..6db77cf7289d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRuleListResultTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.implementation.models.SecurityRuleListResult; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleAccess; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleDirection; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProtocol; +import org.junit.jupiter.api.Assertions; + +public final class SecurityRuleListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SecurityRuleListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"description\":\"nxytxh\",\"protocol\":\"Icmp\",\"sourceAddressPrefixes\":[\"zpfzabglc\",\"hxw\"],\"destinationAddressPrefixes\":[\"yqiklbbovplwzb\"],\"sourcePortRanges\":[\"yuguosvmkfssx\"],\"destinationPortRanges\":[\"kfplgmgsxnk\",\"zkd\"],\"access\":\"Allow\",\"priority\":1649575445,\"direction\":\"Outbound\",\"provisioningState\":\"Canceled\"},\"extendedLocation\":{\"name\":\"wiyighxpkdw\",\"type\":\"CustomLocation\"},\"id\":\"uebbaumnyqup\",\"name\":\"deoj\",\"type\":\"a\"}],\"nextLink\":\"khsmtxpsiebt\"}") + .toObject(SecurityRuleListResult.class); + Assertions.assertEquals("nxytxh", model.value().get(0).properties().description()); + Assertions.assertEquals(SecurityRuleProtocol.ICMP, model.value().get(0).properties().protocol()); + Assertions.assertEquals("zpfzabglc", model.value().get(0).properties().sourceAddressPrefixes().get(0)); + Assertions.assertEquals("yqiklbbovplwzb", + model.value().get(0).properties().destinationAddressPrefixes().get(0)); + Assertions.assertEquals("yuguosvmkfssx", model.value().get(0).properties().sourcePortRanges().get(0)); + Assertions.assertEquals("kfplgmgsxnk", model.value().get(0).properties().destinationPortRanges().get(0)); + Assertions.assertEquals(SecurityRuleAccess.ALLOW, model.value().get(0).properties().access()); + Assertions.assertEquals(1649575445, model.value().get(0).properties().priority()); + Assertions.assertEquals(SecurityRuleDirection.OUTBOUND, model.value().get(0).properties().direction()); + Assertions.assertEquals("wiyighxpkdw", model.value().get(0).extendedLocation().name()); + Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, model.value().get(0).extendedLocation().type()); + Assertions.assertEquals("khsmtxpsiebt", model.nextLink()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulePropertiesTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulePropertiesTests.java new file mode 100644 index 000000000000..43cb3f031683 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulePropertiesTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleAccess; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleDirection; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProtocol; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SecurityRulePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SecurityRuleProperties model = BinaryData.fromString( + "{\"description\":\"aaxdbabphlwrq\",\"protocol\":\"Tcp\",\"sourceAddressPrefixes\":[\"sthsu\",\"ocmnyyazttbtwwrq\",\"uedck\"],\"destinationAddressPrefixes\":[\"biexzfeyu\",\"axibxujw\",\"hqwa\"],\"sourcePortRanges\":[\"zyoxaepdkzjan\",\"ux\"],\"destinationPortRanges\":[\"wbavxbniwdj\"],\"access\":\"Allow\",\"priority\":511976912,\"direction\":\"Inbound\",\"provisioningState\":\"Succeeded\"}") + .toObject(SecurityRuleProperties.class); + Assertions.assertEquals("aaxdbabphlwrq", model.description()); + Assertions.assertEquals(SecurityRuleProtocol.TCP, model.protocol()); + Assertions.assertEquals("sthsu", model.sourceAddressPrefixes().get(0)); + Assertions.assertEquals("biexzfeyu", model.destinationAddressPrefixes().get(0)); + Assertions.assertEquals("zyoxaepdkzjan", model.sourcePortRanges().get(0)); + Assertions.assertEquals("wbavxbniwdj", model.destinationPortRanges().get(0)); + Assertions.assertEquals(SecurityRuleAccess.ALLOW, model.access()); + Assertions.assertEquals(511976912, model.priority()); + Assertions.assertEquals(SecurityRuleDirection.INBOUND, model.direction()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SecurityRuleProperties model = new SecurityRuleProperties().withDescription("aaxdbabphlwrq") + .withProtocol(SecurityRuleProtocol.TCP) + .withSourceAddressPrefixes(Arrays.asList("sthsu", "ocmnyyazttbtwwrq", "uedck")) + .withDestinationAddressPrefixes(Arrays.asList("biexzfeyu", "axibxujw", "hqwa")) + .withSourcePortRanges(Arrays.asList("zyoxaepdkzjan", "ux")) + .withDestinationPortRanges(Arrays.asList("wbavxbniwdj")) + .withAccess(SecurityRuleAccess.ALLOW) + .withPriority(511976912) + .withDirection(SecurityRuleDirection.INBOUND); + model = BinaryData.fromObject(model).toObject(SecurityRuleProperties.class); + Assertions.assertEquals("aaxdbabphlwrq", model.description()); + Assertions.assertEquals(SecurityRuleProtocol.TCP, model.protocol()); + Assertions.assertEquals("sthsu", model.sourceAddressPrefixes().get(0)); + Assertions.assertEquals("biexzfeyu", model.destinationAddressPrefixes().get(0)); + Assertions.assertEquals("zyoxaepdkzjan", model.sourcePortRanges().get(0)); + Assertions.assertEquals("wbavxbniwdj", model.destinationPortRanges().get(0)); + Assertions.assertEquals(SecurityRuleAccess.ALLOW, model.access()); + Assertions.assertEquals(511976912, model.priority()); + Assertions.assertEquals(SecurityRuleDirection.INBOUND, model.direction()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesCreateOrUpdateMockTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..4ae3bc89df6e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesCreateOrUpdateMockTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocation; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRule; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleAccess; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleDirection; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProtocol; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SecurityRulesCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"description\":\"rywvtylbfpn\",\"protocol\":\"Udp\",\"sourceAddressPrefixes\":[\"oiwiithtywub\",\"cbihwqk\"],\"destinationAddressPrefixes\":[\"ntwjch\",\"dgoihxumwctondzj\",\"uu\"],\"sourcePortRanges\":[\"lwg\",\"ytsbwtovv\",\"gseinq\",\"iufxqknpir\"],\"destinationPortRanges\":[\"pttwqmsn\",\"ffcdmqnrojl\",\"ijnkrxfrdd\"],\"access\":\"Allow\",\"priority\":1110792389,\"direction\":\"Inbound\",\"provisioningState\":\"Succeeded\"},\"extendedLocation\":{\"name\":\"ronasxift\",\"type\":\"CustomLocation\"},\"id\":\"zh\",\"name\":\"tw\",\"type\":\"sgogczhonnxk\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureStackHciVmManager manager = AzureStackHciVmManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SecurityRule response = manager.securityRules() + .define("brnjwmw") + .withExistingNetworkSecurityGroup("crpw", "xeznoi") + .withProperties(new SecurityRuleProperties().withDescription("bsazejjoqka") + .withProtocol(SecurityRuleProtocol.ICMP) + .withSourceAddressPrefixes(Arrays.asList("xttaugzxnfaaz", "xdtnkdmkqjjlw")) + .withDestinationAddressPrefixes(Arrays.asList("vrkpyouaibreb")) + .withSourcePortRanges(Arrays.asList("ysjkixqtnqttez", "wfff", "akpjpqqmtedlt", "mjihyeozphv")) + .withDestinationPortRanges(Arrays.asList("y", "ncyg", "p", "vipmdscwxqupevzh")) + .withAccess(SecurityRuleAccess.ALLOW) + .withPriority(434974760) + .withDirection(SecurityRuleDirection.OUTBOUND)) + .withExtendedLocation( + new ExtendedLocation().withName("jujbypelmcuvhixb").withType(ExtendedLocationTypes.CUSTOM_LOCATION)) + .create(); + + Assertions.assertEquals("rywvtylbfpn", response.properties().description()); + Assertions.assertEquals(SecurityRuleProtocol.UDP, response.properties().protocol()); + Assertions.assertEquals("oiwiithtywub", response.properties().sourceAddressPrefixes().get(0)); + Assertions.assertEquals("ntwjch", response.properties().destinationAddressPrefixes().get(0)); + Assertions.assertEquals("lwg", response.properties().sourcePortRanges().get(0)); + Assertions.assertEquals("pttwqmsn", response.properties().destinationPortRanges().get(0)); + Assertions.assertEquals(SecurityRuleAccess.ALLOW, response.properties().access()); + Assertions.assertEquals(1110792389, response.properties().priority()); + Assertions.assertEquals(SecurityRuleDirection.INBOUND, response.properties().direction()); + Assertions.assertEquals("ronasxift", response.extendedLocation().name()); + Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, response.extendedLocation().type()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesGetWithResponseMockTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesGetWithResponseMockTests.java new file mode 100644 index 000000000000..b03dc98dbfa0 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesGetWithResponseMockTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRule; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleAccess; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleDirection; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProtocol; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SecurityRulesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"description\":\"csnjvcdwxlpqekft\",\"protocol\":\"Tcp\",\"sourceAddressPrefixes\":[\"jsyingwfqatm\",\"dhtmdvypgikd\"],\"destinationAddressPrefixes\":[\"ywkbirryuzhlhkjo\",\"rvqqaatj\"],\"sourcePortRanges\":[\"vgoup\"],\"destinationPortRanges\":[\"ib\",\"ggjioolvr\"],\"access\":\"Allow\",\"priority\":1483667739,\"direction\":\"Inbound\",\"provisioningState\":\"Failed\"},\"extendedLocation\":{\"name\":\"llqwjygvjayvblmh\",\"type\":\"CustomLocation\"},\"id\":\"hbxvvyhgsopbyrqu\",\"name\":\"egxuvwzf\",\"type\":\"nhlmctlpdng\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureStackHciVmManager manager = AzureStackHciVmManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SecurityRule response = manager.securityRules() + .getWithResponse("feo", "erqwkyhkobopg", "edkowepbqpcrfk", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("csnjvcdwxlpqekft", response.properties().description()); + Assertions.assertEquals(SecurityRuleProtocol.TCP, response.properties().protocol()); + Assertions.assertEquals("jsyingwfqatm", response.properties().sourceAddressPrefixes().get(0)); + Assertions.assertEquals("ywkbirryuzhlhkjo", response.properties().destinationAddressPrefixes().get(0)); + Assertions.assertEquals("vgoup", response.properties().sourcePortRanges().get(0)); + Assertions.assertEquals("ib", response.properties().destinationPortRanges().get(0)); + Assertions.assertEquals(SecurityRuleAccess.ALLOW, response.properties().access()); + Assertions.assertEquals(1483667739, response.properties().priority()); + Assertions.assertEquals(SecurityRuleDirection.INBOUND, response.properties().direction()); + Assertions.assertEquals("llqwjygvjayvblmh", response.extendedLocation().name()); + Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, response.extendedLocation().type()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesListByNetworkSecurityGroupMockTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesListByNetworkSecurityGroupMockTests.java new file mode 100644 index 000000000000..a8b51a846599 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SecurityRulesListByNetworkSecurityGroupMockTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.azurestackhci.vm.AzureStackHciVmManager; +import com.azure.resourcemanager.azurestackhci.vm.models.ExtendedLocationTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRule; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleAccess; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleDirection; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityRuleProtocol; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class SecurityRulesListByNetworkSecurityGroupMockTests { + @Test + public void testListByNetworkSecurityGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"description\":\"pna\",\"protocol\":\"*\",\"sourceAddressPrefixes\":[\"ccbdre\",\"xhcexdrrvqahq\",\"ghtpw\",\"jnhyjsvf\"],\"destinationAddressPrefixes\":[\"z\"],\"sourcePortRanges\":[\"oowvrv\",\"t\"],\"destinationPortRanges\":[\"ppyostronzmyhgf\"],\"access\":\"Deny\",\"priority\":1358743575,\"direction\":\"Inbound\",\"provisioningState\":\"Canceled\"},\"extendedLocation\":{\"name\":\"waekrrjreafxtsgu\",\"type\":\"CustomLocation\"},\"id\":\"lik\",\"name\":\"xwslolbqpv\",\"type\":\"zlmvfelfktgp\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + AzureStackHciVmManager manager = AzureStackHciVmManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.securityRules() + .listByNetworkSecurityGroup("tvgbmhrixkwmy", "jejveg", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("pna", response.iterator().next().properties().description()); + Assertions.assertEquals(SecurityRuleProtocol.ASTERISK, response.iterator().next().properties().protocol()); + Assertions.assertEquals("ccbdre", response.iterator().next().properties().sourceAddressPrefixes().get(0)); + Assertions.assertEquals("z", response.iterator().next().properties().destinationAddressPrefixes().get(0)); + Assertions.assertEquals("oowvrv", response.iterator().next().properties().sourcePortRanges().get(0)); + Assertions.assertEquals("ppyostronzmyhgf", + response.iterator().next().properties().destinationPortRanges().get(0)); + Assertions.assertEquals(SecurityRuleAccess.DENY, response.iterator().next().properties().access()); + Assertions.assertEquals(1358743575, response.iterator().next().properties().priority()); + Assertions.assertEquals(SecurityRuleDirection.INBOUND, response.iterator().next().properties().direction()); + Assertions.assertEquals("waekrrjreafxtsgu", response.iterator().next().extendedLocation().name()); + Assertions.assertEquals(ExtendedLocationTypes.CUSTOM_LOCATION, + response.iterator().next().extendedLocation().type()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainerStatusProvisioningStatusTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainerStatusProvisioningStatusTests.java new file mode 100644 index 000000000000..89cb3771c945 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainerStatusProvisioningStatusTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.Status; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerStatusProvisioningStatus; +import org.junit.jupiter.api.Assertions; + +public final class StorageContainerStatusProvisioningStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageContainerStatusProvisioningStatus model + = BinaryData.fromString("{\"operationId\":\"vnotyfjfcnj\",\"status\":\"Failed\"}") + .toObject(StorageContainerStatusProvisioningStatus.class); + Assertions.assertEquals("vnotyfjfcnj", model.operationId()); + Assertions.assertEquals(Status.FAILED, model.status()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainerTagsUpdateTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainerTagsUpdateTests.java new file mode 100644 index 000000000000..06631066a3d3 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageContainerTagsUpdateTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageContainerTagsUpdate; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class StorageContainerTagsUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageContainerTagsUpdate model + = BinaryData.fromString("{\"tags\":{\"kphywpnvjto\":\"dhbt\"}}").toObject(StorageContainerTagsUpdate.class); + Assertions.assertEquals("dhbt", model.tags().get("kphywpnvjto")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageContainerTagsUpdate model = new StorageContainerTagsUpdate().withTags(mapOf("kphywpnvjto", "dhbt")); + model = BinaryData.fromObject(model).toObject(StorageContainerTagsUpdate.class); + Assertions.assertEquals("dhbt", model.tags().get("kphywpnvjto")); + } + + // 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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageProfileUpdateTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageProfileUpdateTests.java new file mode 100644 index 000000000000..bd195444083e --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/StorageProfileUpdateTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskArmReference; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class StorageProfileUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageProfileUpdate model + = BinaryData.fromString("{\"dataDisks\":[{\"id\":\"tmuwlauwzi\"}]}").toObject(StorageProfileUpdate.class); + Assertions.assertEquals("tmuwlauwzi", model.dataDisks().get(0).id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageProfileUpdate model = new StorageProfileUpdate() + .withDataDisks(Arrays.asList(new VirtualHardDiskArmReference().withId("tmuwlauwzi"))); + model = BinaryData.fromObject(model).toObject(StorageProfileUpdate.class); + Assertions.assertEquals("tmuwlauwzi", model.dataDisks().get(0).id()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SubnetIpConfigurationReferenceTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SubnetIpConfigurationReferenceTests.java new file mode 100644 index 000000000000..3c7bb5a3b05a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SubnetIpConfigurationReferenceTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.SubnetIpConfigurationReference; +import org.junit.jupiter.api.Assertions; + +public final class SubnetIpConfigurationReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubnetIpConfigurationReference model + = BinaryData.fromString("{\"ID\":\"kirsoodqxhc\"}").toObject(SubnetIpConfigurationReference.class); + Assertions.assertEquals("kirsoodqxhc", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubnetIpConfigurationReference model = new SubnetIpConfigurationReference().withId("kirsoodqxhc"); + model = BinaryData.fromObject(model).toObject(SubnetIpConfigurationReference.class); + Assertions.assertEquals("kirsoodqxhc", model.id()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SubnetPropertiesTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SubnetPropertiesTests.java new file mode 100644 index 000000000000..7ac76c138ada --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SubnetPropertiesTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.fluent.models.SubnetProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.IPPool; +import com.azure.resourcemanager.azurestackhci.vm.models.IPPoolInfo; +import com.azure.resourcemanager.azurestackhci.vm.models.IPPoolTypeEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.IpAllocationMethodEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.Route; +import com.azure.resourcemanager.azurestackhci.vm.models.RouteTable; +import com.azure.resourcemanager.azurestackhci.vm.models.SubnetIpConfigurationReference; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SubnetPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SubnetProperties model = BinaryData.fromString( + "{\"addressPrefix\":\"mnkzsmod\",\"addressPrefixes\":[\"ougpbkwt\",\"utduqktapspwgcu\"],\"ipAllocationMethod\":\"Static\",\"ipConfigurationReferences\":[{\"ID\":\"dosvqwhbmdgbbjf\"}],\"networkSecurityGroup\":{\"id\":\"mbmbexppbh\"},\"routeTable\":{\"etag\":\"rolfpfp\",\"name\":\"lgbquxig\",\"type\":\"jgzjaoyfhrtx\",\"properties\":{\"routes\":[{\"properties\":{\"addressPrefix\":\"ujysvle\",\"nextHopIpAddress\":\"vfqawrlyxwjkcpr\"},\"name\":\"wbxgjvt\"},{\"properties\":{\"addressPrefix\":\"ysszdnrujqguh\",\"nextHopIpAddress\":\"ouqfprwz\"},\"name\":\"nguitnwuizgazxu\"}]}},\"ipPools\":[{\"name\":\"ckyfih\",\"ipPoolType\":\"vm\",\"start\":\"fvzwdzuhty\",\"end\":\"isdkfthwxmnteiw\",\"info\":{\"used\":\"vkmijcmmxdcuf\",\"available\":\"srp\"}},{\"name\":\"zidnsezcxtbzsgfy\",\"ipPoolType\":\"vm\",\"start\":\"ewmdw\",\"end\":\"eiachboosflnr\",\"info\":{\"used\":\"qpteeh\",\"available\":\"vypyqrimzinpv\"}}],\"vlan\":694156912}") + .toObject(SubnetProperties.class); + Assertions.assertEquals("mnkzsmod", model.addressPrefix()); + Assertions.assertEquals("ougpbkwt", model.addressPrefixes().get(0)); + Assertions.assertEquals(IpAllocationMethodEnum.STATIC, model.ipAllocationMethod()); + Assertions.assertEquals("dosvqwhbmdgbbjf", model.ipConfigurationReferences().get(0).id()); + Assertions.assertEquals("mbmbexppbh", model.networkSecurityGroup().id()); + Assertions.assertEquals("wbxgjvt", model.routeTable().routes().get(0).name()); + Assertions.assertEquals("ujysvle", model.routeTable().routes().get(0).addressPrefix()); + Assertions.assertEquals("vfqawrlyxwjkcpr", model.routeTable().routes().get(0).nextHopIpAddress()); + Assertions.assertEquals("ckyfih", model.ipPools().get(0).name()); + Assertions.assertEquals(IPPoolTypeEnum.VM, model.ipPools().get(0).ipPoolType()); + Assertions.assertEquals("fvzwdzuhty", model.ipPools().get(0).start()); + Assertions.assertEquals("isdkfthwxmnteiw", model.ipPools().get(0).end()); + Assertions.assertEquals(694156912, model.vlan()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SubnetProperties model = new SubnetProperties().withAddressPrefix("mnkzsmod") + .withAddressPrefixes(Arrays.asList("ougpbkwt", "utduqktapspwgcu")) + .withIpAllocationMethod(IpAllocationMethodEnum.STATIC) + .withIpConfigurationReferences( + Arrays.asList(new SubnetIpConfigurationReference().withId("dosvqwhbmdgbbjf"))) + .withNetworkSecurityGroup(new NetworkSecurityGroupArmReference().withId("mbmbexppbh")) + .withRouteTable(new RouteTable().withRoutes(Arrays.asList( + new Route().withName("wbxgjvt").withAddressPrefix("ujysvle").withNextHopIpAddress("vfqawrlyxwjkcpr"), + new Route().withName("nguitnwuizgazxu") + .withAddressPrefix("ysszdnrujqguh") + .withNextHopIpAddress("ouqfprwz")))) + .withIpPools(Arrays.asList( + new IPPool().withName("ckyfih") + .withIpPoolType(IPPoolTypeEnum.VM) + .withStart("fvzwdzuhty") + .withEnd("isdkfthwxmnteiw") + .withInfo(new IPPoolInfo()), + new IPPool().withName("zidnsezcxtbzsgfy") + .withIpPoolType(IPPoolTypeEnum.VM) + .withStart("ewmdw") + .withEnd("eiachboosflnr") + .withInfo(new IPPoolInfo()))) + .withVlan(694156912); + model = BinaryData.fromObject(model).toObject(SubnetProperties.class); + Assertions.assertEquals("mnkzsmod", model.addressPrefix()); + Assertions.assertEquals("ougpbkwt", model.addressPrefixes().get(0)); + Assertions.assertEquals(IpAllocationMethodEnum.STATIC, model.ipAllocationMethod()); + Assertions.assertEquals("dosvqwhbmdgbbjf", model.ipConfigurationReferences().get(0).id()); + Assertions.assertEquals("mbmbexppbh", model.networkSecurityGroup().id()); + Assertions.assertEquals("wbxgjvt", model.routeTable().routes().get(0).name()); + Assertions.assertEquals("ujysvle", model.routeTable().routes().get(0).addressPrefix()); + Assertions.assertEquals("vfqawrlyxwjkcpr", model.routeTable().routes().get(0).nextHopIpAddress()); + Assertions.assertEquals("ckyfih", model.ipPools().get(0).name()); + Assertions.assertEquals(IPPoolTypeEnum.VM, model.ipPools().get(0).ipPoolType()); + Assertions.assertEquals("fvzwdzuhty", model.ipPools().get(0).start()); + Assertions.assertEquals("isdkfthwxmnteiw", model.ipPools().get(0).end()); + Assertions.assertEquals(694156912, model.vlan()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SubnetTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SubnetTests.java new file mode 100644 index 000000000000..ccc52371cd9d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/SubnetTests.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.IPPool; +import com.azure.resourcemanager.azurestackhci.vm.models.IPPoolInfo; +import com.azure.resourcemanager.azurestackhci.vm.models.IPPoolTypeEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.IpAllocationMethodEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkSecurityGroupArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.Route; +import com.azure.resourcemanager.azurestackhci.vm.models.RouteTable; +import com.azure.resourcemanager.azurestackhci.vm.models.Subnet; +import com.azure.resourcemanager.azurestackhci.vm.models.SubnetIpConfigurationReference; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SubnetTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Subnet model = BinaryData.fromString( + "{\"properties\":{\"addressPrefix\":\"gbwjzrnf\",\"addressPrefixes\":[\"gispemvtzfkufubl\",\"ofx\",\"eofjaeqjh\",\"jbasvmsmjqulngs\"],\"ipAllocationMethod\":\"Static\",\"ipConfigurationReferences\":[{\"ID\":\"kzgcwrwcl\"},{\"ID\":\"wrljdouskc\"}],\"networkSecurityGroup\":{\"id\":\"ocrcjdk\"},\"routeTable\":{\"etag\":\"hxbnjbiksqrg\",\"name\":\"sainqpjwnzl\",\"type\":\"fmppe\",\"properties\":{\"routes\":[{\"properties\":{},\"name\":\"sabkyqduujitcjcz\"},{\"properties\":{},\"name\":\"vndhkrwpdapp\"}]}},\"ipPools\":[{\"name\":\"kvwrwjfeu\",\"ipPoolType\":\"vm\",\"start\":\"tjelt\",\"end\":\"ldhugjzzdatqxh\",\"info\":{\"used\":\"geablgphuticndvk\",\"available\":\"zwyiftyhxhur\"}},{\"name\":\"ftyxolniw\",\"ipPoolType\":\"vm\",\"start\":\"kjfkg\",\"end\":\"w\",\"info\":{\"used\":\"ryplwckbasyypn\",\"available\":\"hsgcbacphejkot\"}},{\"name\":\"qgoulznd\",\"ipPoolType\":\"vm\",\"start\":\"yqkgfg\",\"end\":\"madgakeqsrxyb\",\"info\":{\"used\":\"e\",\"available\":\"ytb\"}}],\"vlan\":834029576},\"name\":\"ouf\"}") + .toObject(Subnet.class); + Assertions.assertEquals("ouf", model.name()); + Assertions.assertEquals("gbwjzrnf", model.addressPrefix()); + Assertions.assertEquals("gispemvtzfkufubl", model.addressPrefixes().get(0)); + Assertions.assertEquals(IpAllocationMethodEnum.STATIC, model.ipAllocationMethod()); + Assertions.assertEquals("kzgcwrwcl", model.ipConfigurationReferences().get(0).id()); + Assertions.assertEquals("ocrcjdk", model.networkSecurityGroup().id()); + Assertions.assertEquals("sabkyqduujitcjcz", model.routeTable().routes().get(0).name()); + Assertions.assertEquals("kvwrwjfeu", model.ipPools().get(0).name()); + Assertions.assertEquals(IPPoolTypeEnum.VM, model.ipPools().get(0).ipPoolType()); + Assertions.assertEquals("tjelt", model.ipPools().get(0).start()); + Assertions.assertEquals("ldhugjzzdatqxh", model.ipPools().get(0).end()); + Assertions.assertEquals(834029576, model.vlan()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Subnet model = new Subnet().withName("ouf") + .withAddressPrefix("gbwjzrnf") + .withAddressPrefixes(Arrays.asList("gispemvtzfkufubl", "ofx", "eofjaeqjh", "jbasvmsmjqulngs")) + .withIpAllocationMethod(IpAllocationMethodEnum.STATIC) + .withIpConfigurationReferences(Arrays.asList(new SubnetIpConfigurationReference().withId("kzgcwrwcl"), + new SubnetIpConfigurationReference().withId("wrljdouskc"))) + .withNetworkSecurityGroup(new NetworkSecurityGroupArmReference().withId("ocrcjdk")) + .withRouteTable(new RouteTable().withRoutes( + Arrays.asList(new Route().withName("sabkyqduujitcjcz"), new Route().withName("vndhkrwpdapp")))) + .withIpPools(Arrays.asList( + new IPPool().withName("kvwrwjfeu") + .withIpPoolType(IPPoolTypeEnum.VM) + .withStart("tjelt") + .withEnd("ldhugjzzdatqxh") + .withInfo(new IPPoolInfo()), + new IPPool().withName("ftyxolniw") + .withIpPoolType(IPPoolTypeEnum.VM) + .withStart("kjfkg") + .withEnd("w") + .withInfo(new IPPoolInfo()), + new IPPool().withName("qgoulznd") + .withIpPoolType(IPPoolTypeEnum.VM) + .withStart("yqkgfg") + .withEnd("madgakeqsrxyb") + .withInfo(new IPPoolInfo()))) + .withVlan(834029576); + model = BinaryData.fromObject(model).toObject(Subnet.class); + Assertions.assertEquals("ouf", model.name()); + Assertions.assertEquals("gbwjzrnf", model.addressPrefix()); + Assertions.assertEquals("gispemvtzfkufubl", model.addressPrefixes().get(0)); + Assertions.assertEquals(IpAllocationMethodEnum.STATIC, model.ipAllocationMethod()); + Assertions.assertEquals("kzgcwrwcl", model.ipConfigurationReferences().get(0).id()); + Assertions.assertEquals("ocrcjdk", model.networkSecurityGroup().id()); + Assertions.assertEquals("sabkyqduujitcjcz", model.routeTable().routes().get(0).name()); + Assertions.assertEquals("kvwrwjfeu", model.ipPools().get(0).name()); + Assertions.assertEquals(IPPoolTypeEnum.VM, model.ipPools().get(0).ipPoolType()); + Assertions.assertEquals("tjelt", model.ipPools().get(0).start()); + Assertions.assertEquals("ldhugjzzdatqxh", model.ipPools().get(0).end()); + Assertions.assertEquals(834029576, model.vlan()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/UserAssignedIdentityTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/UserAssignedIdentityTests.java new file mode 100644 index 000000000000..31d95abe650d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/UserAssignedIdentityTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model + = BinaryData.fromString("{\"principalId\":\"srfbjfdtwss\",\"clientId\":\"ftpvjzbexil\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VMDiskSecurityProfileTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VMDiskSecurityProfileTests.java new file mode 100644 index 000000000000..0b00a2bded38 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VMDiskSecurityProfileTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityEncryptionType; +import com.azure.resourcemanager.azurestackhci.vm.models.VMDiskSecurityProfile; +import org.junit.jupiter.api.Assertions; + +public final class VMDiskSecurityProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMDiskSecurityProfile model = BinaryData.fromString("{\"securityEncryptionType\":\"NonPersistedTPM\"}") + .toObject(VMDiskSecurityProfile.class); + Assertions.assertEquals(SecurityEncryptionType.NON_PERSISTED_TPM, model.securityEncryptionType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMDiskSecurityProfile model + = new VMDiskSecurityProfile().withSecurityEncryptionType(SecurityEncryptionType.NON_PERSISTED_TPM); + model = BinaryData.fromObject(model).toObject(VMDiskSecurityProfile.class); + Assertions.assertEquals(SecurityEncryptionType.NON_PERSISTED_TPM, model.securityEncryptionType()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskArmReferenceTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskArmReferenceTests.java new file mode 100644 index 000000000000..7508b6e9f977 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskArmReferenceTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskArmReference; +import org.junit.jupiter.api.Assertions; + +public final class VirtualHardDiskArmReferenceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualHardDiskArmReference model + = BinaryData.fromString("{\"id\":\"qwwncw\"}").toObject(VirtualHardDiskArmReference.class); + Assertions.assertEquals("qwwncw", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualHardDiskArmReference model = new VirtualHardDiskArmReference().withId("qwwncw"); + model = BinaryData.fromObject(model).toObject(VirtualHardDiskArmReference.class); + Assertions.assertEquals("qwwncw", model.id()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskDownloadStatusTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskDownloadStatusTests.java new file mode 100644 index 000000000000..f8c7c52ff89d --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskDownloadStatusTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.Status; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskDownloadStatus; +import org.junit.jupiter.api.Assertions; + +public final class VirtualHardDiskDownloadStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualHardDiskDownloadStatus model = BinaryData.fromString( + "{\"downloadedSizeInMB\":5146449711958438241,\"status\":\"InProgress\",\"progressPercentage\":1809272573245820148}") + .toObject(VirtualHardDiskDownloadStatus.class); + Assertions.assertEquals(5146449711958438241L, model.downloadedSizeInMB()); + Assertions.assertEquals(Status.IN_PROGRESS, model.status()); + Assertions.assertEquals(1809272573245820148L, model.progressPercentage()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskStatusProvisioningStatusTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskStatusProvisioningStatusTests.java new file mode 100644 index 000000000000..0b043d6828ff --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskStatusProvisioningStatusTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.Status; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskStatusProvisioningStatus; +import org.junit.jupiter.api.Assertions; + +public final class VirtualHardDiskStatusProvisioningStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualHardDiskStatusProvisioningStatus model + = BinaryData.fromString("{\"operationId\":\"rnwb\",\"status\":\"Failed\"}") + .toObject(VirtualHardDiskStatusProvisioningStatus.class); + Assertions.assertEquals("rnwb", model.operationId()); + Assertions.assertEquals(Status.FAILED, model.status()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskUploadRequestTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskUploadRequestTests.java new file mode 100644 index 000000000000..ff7a50f3ceda --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDiskUploadRequestTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskUploadRequest; +import org.junit.jupiter.api.Assertions; + +public final class VirtualHardDiskUploadRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualHardDiskUploadRequest model = BinaryData.fromString("{\"azureManagedDiskUploadUrl\":\"ucww\"}") + .toObject(VirtualHardDiskUploadRequest.class); + Assertions.assertEquals("ucww", model.azureManagedDiskUploadUrl()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualHardDiskUploadRequest model = new VirtualHardDiskUploadRequest().withAzureManagedDiskUploadUrl("ucww"); + model = BinaryData.fromObject(model).toObject(VirtualHardDiskUploadRequest.class); + Assertions.assertEquals("ucww", model.azureManagedDiskUploadUrl()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUpdatePropertiesTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUpdatePropertiesTests.java new file mode 100644 index 000000000000..16a59f330e8b --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUpdatePropertiesTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisksUpdateProperties; +import org.junit.jupiter.api.Assertions; + +public final class VirtualHardDisksUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualHardDisksUpdateProperties model = BinaryData.fromString("{\"diskSizeGB\":3600138171272863845}") + .toObject(VirtualHardDisksUpdateProperties.class); + Assertions.assertEquals(3600138171272863845L, model.diskSizeGB()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualHardDisksUpdateProperties model + = new VirtualHardDisksUpdateProperties().withDiskSizeGB(3600138171272863845L); + model = BinaryData.fromObject(model).toObject(VirtualHardDisksUpdateProperties.class); + Assertions.assertEquals(3600138171272863845L, model.diskSizeGB()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUpdateRequestTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUpdateRequestTests.java new file mode 100644 index 000000000000..c8ecefc2e093 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualHardDisksUpdateRequestTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisksUpdateProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDisksUpdateRequest; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class VirtualHardDisksUpdateRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualHardDisksUpdateRequest model = BinaryData.fromString( + "{\"tags\":{\"hvljuahaquh\":\"krh\",\"aex\":\"dhmdua\",\"vxpvgomz\":\"pvfadmwsrcr\"},\"properties\":{\"diskSizeGB\":6983403361765190016}}") + .toObject(VirtualHardDisksUpdateRequest.class); + Assertions.assertEquals("krh", model.tags().get("hvljuahaquh")); + Assertions.assertEquals(6983403361765190016L, model.properties().diskSizeGB()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualHardDisksUpdateRequest model = new VirtualHardDisksUpdateRequest() + .withTags(mapOf("hvljuahaquh", "krh", "aex", "dhmdua", "vxpvgomz", "pvfadmwsrcr")) + .withProperties(new VirtualHardDisksUpdateProperties().withDiskSizeGB(6983403361765190016L)); + model = BinaryData.fromObject(model).toObject(VirtualHardDisksUpdateRequest.class); + Assertions.assertEquals("krh", model.tags().get("hvljuahaquh")); + Assertions.assertEquals(6983403361765190016L, model.properties().diskSizeGB()); + } + + // 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/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceManagedDiskParametersTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceManagedDiskParametersTests.java new file mode 100644 index 000000000000..a4c41937d647 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceManagedDiskParametersTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityEncryptionType; +import com.azure.resourcemanager.azurestackhci.vm.models.VMDiskSecurityProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceManagedDiskParameters; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstanceManagedDiskParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstanceManagedDiskParameters model + = BinaryData.fromString("{\"securityProfile\":{\"securityEncryptionType\":\"NonPersistedTPM\"}}") + .toObject(VirtualMachineInstanceManagedDiskParameters.class); + Assertions.assertEquals(SecurityEncryptionType.NON_PERSISTED_TPM, + model.securityProfile().securityEncryptionType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstanceManagedDiskParameters model + = new VirtualMachineInstanceManagedDiskParameters().withSecurityProfile( + new VMDiskSecurityProfile().withSecurityEncryptionType(SecurityEncryptionType.NON_PERSISTED_TPM)); + model = BinaryData.fromObject(model).toObject(VirtualMachineInstanceManagedDiskParameters.class); + Assertions.assertEquals(SecurityEncryptionType.NON_PERSISTED_TPM, + model.securityProfile().securityEncryptionType()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTests.java new file mode 100644 index 000000000000..bc70dbc3a2bd --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfigTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig model = BinaryData.fromString( + "{\"maximumMemoryMB\":7813618899616430195,\"minimumMemoryMB\":495933413670136065,\"targetMemoryBuffer\":1754120882}") + .toObject(VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.class); + Assertions.assertEquals(7813618899616430195L, model.maximumMemoryMB()); + Assertions.assertEquals(495933413670136065L, model.minimumMemoryMB()); + Assertions.assertEquals(1754120882, model.targetMemoryBuffer()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig model + = new VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig() + .withMaximumMemoryMB(7813618899616430195L) + .withMinimumMemoryMB(495933413670136065L) + .withTargetMemoryBuffer(1754120882); + model = BinaryData.fromObject(model) + .toObject(VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig.class); + Assertions.assertEquals(7813618899616430195L, model.maximumMemoryMB()); + Assertions.assertEquals(495933413670136065L, model.minimumMemoryMB()); + Assertions.assertEquals(1754120882, model.targetMemoryBuffer()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesHardwareProfileTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesHardwareProfileTests.java new file mode 100644 index 000000000000..63bc4fb849c1 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesHardwareProfileTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GpuAssignmentTypeEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU; +import com.azure.resourcemanager.azurestackhci.vm.models.VmSizeEnum; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstancePropertiesHardwareProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstancePropertiesHardwareProfile model = BinaryData.fromString( + "{\"vmSize\":\"Standard_D16s_v3\",\"processors\":1486337456,\"memoryMB\":6144174767385086572,\"dynamicMemoryConfig\":{\"maximumMemoryMB\":4014214152987643703,\"minimumMemoryMB\":6160997583833316786,\"targetMemoryBuffer\":841332893},\"virtualMachineGPUs\":[{\"assignmentType\":\"GpuDDA\",\"partitionSizeMB\":2641489064592308886,\"gpuName\":\"apj\"},{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":7368048825846520103,\"gpuName\":\"qzcjrvxdj\"},{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":6071942572000377997,\"gpuName\":\"kvugfhzovawjvzun\"},{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":5088500223485653746,\"gpuName\":\"prnxipeil\"}]}") + .toObject(VirtualMachineInstancePropertiesHardwareProfile.class); + Assertions.assertEquals(VmSizeEnum.STANDARD_D16S_V3, model.vmSize()); + Assertions.assertEquals(1486337456, model.processors()); + Assertions.assertEquals(6144174767385086572L, model.memoryMB()); + Assertions.assertEquals(4014214152987643703L, model.dynamicMemoryConfig().maximumMemoryMB()); + Assertions.assertEquals(6160997583833316786L, model.dynamicMemoryConfig().minimumMemoryMB()); + Assertions.assertEquals(841332893, model.dynamicMemoryConfig().targetMemoryBuffer()); + Assertions.assertEquals(GpuAssignmentTypeEnum.GPU_DDA, model.virtualMachineGPUs().get(0).assignmentType()); + Assertions.assertEquals(2641489064592308886L, model.virtualMachineGPUs().get(0).partitionSizeMB()); + Assertions.assertEquals("apj", model.virtualMachineGPUs().get(0).gpuName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstancePropertiesHardwareProfile model + = new VirtualMachineInstancePropertiesHardwareProfile().withVmSize(VmSizeEnum.STANDARD_D16S_V3) + .withProcessors(1486337456) + .withMemoryMB(6144174767385086572L) + .withDynamicMemoryConfig(new VirtualMachineInstancePropertiesHardwareProfileDynamicMemoryConfig() + .withMaximumMemoryMB(4014214152987643703L) + .withMinimumMemoryMB(6160997583833316786L) + .withTargetMemoryBuffer(841332893)) + .withVirtualMachineGPUs(Arrays.asList( + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPU_DDA) + .withPartitionSizeMB(2641489064592308886L) + .withGpuName("apj"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(7368048825846520103L) + .withGpuName("qzcjrvxdj"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(6071942572000377997L) + .withGpuName("kvugfhzovawjvzun"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(5088500223485653746L) + .withGpuName("prnxipeil"))); + model = BinaryData.fromObject(model).toObject(VirtualMachineInstancePropertiesHardwareProfile.class); + Assertions.assertEquals(VmSizeEnum.STANDARD_D16S_V3, model.vmSize()); + Assertions.assertEquals(1486337456, model.processors()); + Assertions.assertEquals(6144174767385086572L, model.memoryMB()); + Assertions.assertEquals(4014214152987643703L, model.dynamicMemoryConfig().maximumMemoryMB()); + Assertions.assertEquals(6160997583833316786L, model.dynamicMemoryConfig().minimumMemoryMB()); + Assertions.assertEquals(841332893, model.dynamicMemoryConfig().targetMemoryBuffer()); + Assertions.assertEquals(GpuAssignmentTypeEnum.GPU_DDA, model.virtualMachineGPUs().get(0).assignmentType()); + Assertions.assertEquals(2641489064592308886L, model.virtualMachineGPUs().get(0).partitionSizeMB()); + Assertions.assertEquals("apj", model.virtualMachineGPUs().get(0).gpuName()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPUTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPUTests.java new file mode 100644 index 000000000000..63c3d8b07501 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPUTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GpuAssignmentTypeEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPUTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU model = BinaryData + .fromString( + "{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":7440682274969203666,\"gpuName\":\"zbbtdzumveek\"}") + .toObject(VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU.class); + Assertions.assertEquals(GpuAssignmentTypeEnum.GPUP, model.assignmentType()); + Assertions.assertEquals(7440682274969203666L, model.partitionSizeMB()); + Assertions.assertEquals("zbbtdzumveek", model.gpuName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU model + = new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(7440682274969203666L) + .withGpuName("zbbtdzumveek"); + model = BinaryData.fromObject(model) + .toObject(VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU.class); + Assertions.assertEquals(GpuAssignmentTypeEnum.GPUP, model.assignmentType()); + Assertions.assertEquals(7440682274969203666L, model.partitionSizeMB()); + Assertions.assertEquals("zbbtdzumveek", model.gpuName()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesNetworkProfileTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesNetworkProfileTests.java new file mode 100644 index 000000000000..5b2472c29b52 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesNetworkProfileTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesNetworkProfile; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstancePropertiesNetworkProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstancePropertiesNetworkProfile model + = BinaryData.fromString("{\"networkInterfaces\":[{\"id\":\"f\"}]}") + .toObject(VirtualMachineInstancePropertiesNetworkProfile.class); + Assertions.assertEquals("f", model.networkInterfaces().get(0).id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstancePropertiesNetworkProfile model = new VirtualMachineInstancePropertiesNetworkProfile() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId("f"))); + model = BinaryData.fromObject(model).toObject(VirtualMachineInstancePropertiesNetworkProfile.class); + Assertions.assertEquals("f", model.networkInterfaces().get(0).id()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesPlacementProfileTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesPlacementProfileTests.java new file mode 100644 index 000000000000..2c1c880be6ad --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesPlacementProfileTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesPlacementProfile; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstancePropertiesPlacementProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstancePropertiesPlacementProfile model + = BinaryData.fromString("{\"zone\":\"wozuhkf\",\"strictPlacementPolicy\":false}") + .toObject(VirtualMachineInstancePropertiesPlacementProfile.class); + Assertions.assertEquals("wozuhkf", model.zone()); + Assertions.assertFalse(model.strictPlacementPolicy()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstancePropertiesPlacementProfile model + = new VirtualMachineInstancePropertiesPlacementProfile().withZone("wozuhkf") + .withStrictPlacementPolicy(false); + model = BinaryData.fromObject(model).toObject(VirtualMachineInstancePropertiesPlacementProfile.class); + Assertions.assertEquals("wozuhkf", model.zone()); + Assertions.assertFalse(model.strictPlacementPolicy()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesSecurityProfileTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesSecurityProfileTests.java new file mode 100644 index 000000000000..d1c50cdac1a8 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesSecurityProfileTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesSecurityProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesSecurityProfileUefiSettings; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstancePropertiesSecurityProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstancePropertiesSecurityProfile model = BinaryData.fromString( + "{\"enableTPM\":false,\"uefiSettings\":{\"secureBootEnabled\":false},\"securityType\":\"ConfidentialVM\"}") + .toObject(VirtualMachineInstancePropertiesSecurityProfile.class); + Assertions.assertFalse(model.enableTPM()); + Assertions.assertFalse(model.uefiSettings().secureBootEnabled()); + Assertions.assertEquals(SecurityTypes.CONFIDENTIAL_VM, model.securityType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstancePropertiesSecurityProfile model + = new VirtualMachineInstancePropertiesSecurityProfile().withEnableTPM(false) + .withUefiSettings( + new VirtualMachineInstancePropertiesSecurityProfileUefiSettings().withSecureBootEnabled(false)) + .withSecurityType(SecurityTypes.CONFIDENTIAL_VM); + model = BinaryData.fromObject(model).toObject(VirtualMachineInstancePropertiesSecurityProfile.class); + Assertions.assertFalse(model.enableTPM()); + Assertions.assertFalse(model.uefiSettings().secureBootEnabled()); + Assertions.assertEquals(SecurityTypes.CONFIDENTIAL_VM, model.securityType()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTests.java new file mode 100644 index 000000000000..ebd1ef9e40ed --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesSecurityProfileUefiSettings; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstancePropertiesSecurityProfileUefiSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstancePropertiesSecurityProfileUefiSettings model + = BinaryData.fromString("{\"secureBootEnabled\":true}") + .toObject(VirtualMachineInstancePropertiesSecurityProfileUefiSettings.class); + Assertions.assertTrue(model.secureBootEnabled()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstancePropertiesSecurityProfileUefiSettings model + = new VirtualMachineInstancePropertiesSecurityProfileUefiSettings().withSecureBootEnabled(true); + model + = BinaryData.fromObject(model).toObject(VirtualMachineInstancePropertiesSecurityProfileUefiSettings.class); + Assertions.assertTrue(model.secureBootEnabled()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesStorageProfileOsDiskTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesStorageProfileOsDiskTests.java new file mode 100644 index 000000000000..b99554ab54bf --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesStorageProfileOsDiskTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.OperatingSystemTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityEncryptionType; +import com.azure.resourcemanager.azurestackhci.vm.models.VMDiskSecurityProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceManagedDiskParameters; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesStorageProfileOsDisk; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstancePropertiesStorageProfileOsDiskTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstancePropertiesStorageProfileOsDisk model = BinaryData.fromString( + "{\"id\":\"rmgucnap\",\"osType\":\"Linux\",\"managedDisk\":{\"securityProfile\":{\"securityEncryptionType\":\"NonPersistedTPM\"}}}") + .toObject(VirtualMachineInstancePropertiesStorageProfileOsDisk.class); + Assertions.assertEquals("rmgucnap", model.id()); + Assertions.assertEquals(OperatingSystemTypes.LINUX, model.osType()); + Assertions.assertEquals(SecurityEncryptionType.NON_PERSISTED_TPM, + model.managedDisk().securityProfile().securityEncryptionType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstancePropertiesStorageProfileOsDisk model + = new VirtualMachineInstancePropertiesStorageProfileOsDisk().withId("rmgucnap") + .withOsType(OperatingSystemTypes.LINUX) + .withManagedDisk(new VirtualMachineInstanceManagedDiskParameters().withSecurityProfile( + new VMDiskSecurityProfile().withSecurityEncryptionType(SecurityEncryptionType.NON_PERSISTED_TPM))); + model = BinaryData.fromObject(model).toObject(VirtualMachineInstancePropertiesStorageProfileOsDisk.class); + Assertions.assertEquals("rmgucnap", model.id()); + Assertions.assertEquals(OperatingSystemTypes.LINUX, model.osType()); + Assertions.assertEquals(SecurityEncryptionType.NON_PERSISTED_TPM, + model.managedDisk().securityProfile().securityEncryptionType()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesStorageProfileTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesStorageProfileTests.java new file mode 100644 index 000000000000..7d1e3c218249 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstancePropertiesStorageProfileTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.ImageArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.OperatingSystemTypes; +import com.azure.resourcemanager.azurestackhci.vm.models.SecurityEncryptionType; +import com.azure.resourcemanager.azurestackhci.vm.models.VMDiskSecurityProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceManagedDiskParameters; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesStorageProfile; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesStorageProfileOsDisk; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstancePropertiesStorageProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstancePropertiesStorageProfile model = BinaryData.fromString( + "{\"dataDisks\":[{\"id\":\"xznelixhnrztf\"}],\"imageReference\":{\"id\":\"bnxknalaulppg\"},\"osDisk\":{\"id\":\"pnapnyiropuh\",\"osType\":\"Windows\",\"managedDisk\":{\"securityProfile\":{\"securityEncryptionType\":\"NonPersistedTPM\"}}},\"vmConfigStoragePathId\":\"gqgitxmedjvcsl\"}") + .toObject(VirtualMachineInstancePropertiesStorageProfile.class); + Assertions.assertEquals("xznelixhnrztf", model.dataDisks().get(0).id()); + Assertions.assertEquals("bnxknalaulppg", model.imageReference().id()); + Assertions.assertEquals("pnapnyiropuh", model.osDisk().id()); + Assertions.assertEquals(OperatingSystemTypes.WINDOWS, model.osDisk().osType()); + Assertions.assertEquals(SecurityEncryptionType.NON_PERSISTED_TPM, + model.osDisk().managedDisk().securityProfile().securityEncryptionType()); + Assertions.assertEquals("gqgitxmedjvcsl", model.vmConfigStoragePathId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstancePropertiesStorageProfile model = new VirtualMachineInstancePropertiesStorageProfile() + .withDataDisks(Arrays.asList(new VirtualHardDiskArmReference().withId("xznelixhnrztf"))) + .withImageReference(new ImageArmReference().withId("bnxknalaulppg")) + .withOsDisk(new VirtualMachineInstancePropertiesStorageProfileOsDisk().withId("pnapnyiropuh") + .withOsType(OperatingSystemTypes.WINDOWS) + .withManagedDisk(new VirtualMachineInstanceManagedDiskParameters().withSecurityProfile( + new VMDiskSecurityProfile().withSecurityEncryptionType(SecurityEncryptionType.NON_PERSISTED_TPM)))) + .withVmConfigStoragePathId("gqgitxmedjvcsl"); + model = BinaryData.fromObject(model).toObject(VirtualMachineInstancePropertiesStorageProfile.class); + Assertions.assertEquals("xznelixhnrztf", model.dataDisks().get(0).id()); + Assertions.assertEquals("bnxknalaulppg", model.imageReference().id()); + Assertions.assertEquals("pnapnyiropuh", model.osDisk().id()); + Assertions.assertEquals(OperatingSystemTypes.WINDOWS, model.osDisk().osType()); + Assertions.assertEquals(SecurityEncryptionType.NON_PERSISTED_TPM, + model.osDisk().managedDisk().securityProfile().securityEncryptionType()); + Assertions.assertEquals("gqgitxmedjvcsl", model.vmConfigStoragePathId()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceStatusProvisioningStatusTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceStatusProvisioningStatusTests.java new file mode 100644 index 000000000000..2b027c9aad86 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceStatusProvisioningStatusTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.Status; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceStatusProvisioningStatus; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstanceStatusProvisioningStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstanceStatusProvisioningStatus model + = BinaryData.fromString("{\"operationId\":\"vetvt\",\"status\":\"InProgress\"}") + .toObject(VirtualMachineInstanceStatusProvisioningStatus.class); + Assertions.assertEquals("vetvt", model.operationId()); + Assertions.assertEquals(Status.IN_PROGRESS, model.status()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceUpdatePropertiesTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceUpdatePropertiesTests.java new file mode 100644 index 000000000000..c79a67dcb738 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceUpdatePropertiesTests.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GpuAssignmentTypeEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.HardwareProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateLinuxConfiguration; +import com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateWindowsConfiguration; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.VmSizeEnum; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstanceUpdatePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstanceUpdateProperties model = BinaryData.fromString( + "{\"hardwareProfile\":{\"vmSize\":\"Standard_DS4_v2\",\"processors\":11756294,\"memoryMB\":1564863042825261686,\"virtualMachineGPUs\":[{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":4154359310176459322,\"gpuName\":\"hh\"},{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":8381465427069984975,\"gpuName\":\"ucerscdntnevfi\"},{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":2197529378012958705,\"gpuName\":\"dsslswt\"},{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":1708954452668375735,\"gpuName\":\"fzp\"}]},\"storageProfile\":{\"dataDisks\":[{\"id\":\"wab\"},{\"id\":\"tshhszhedp\"}]},\"networkProfile\":{\"networkInterfaces\":[{\"id\":\"ubmwmbesld\"},{\"id\":\"wwtppj\"},{\"id\":\"cxogaokonzm\"},{\"id\":\"ikvmkqzeqqk\"}]},\"osProfile\":{\"computerName\":\"fzxmhhvhgureodkw\",\"linuxConfiguration\":{\"provisionVMAgent\":false,\"provisionVMConfigAgent\":true},\"windowsConfiguration\":{\"provisionVMAgent\":false,\"provisionVMConfigAgent\":false}}}") + .toObject(VirtualMachineInstanceUpdateProperties.class); + Assertions.assertEquals(VmSizeEnum.STANDARD_DS4_V2, model.hardwareProfile().vmSize()); + Assertions.assertEquals(11756294, model.hardwareProfile().processors()); + Assertions.assertEquals(1564863042825261686L, model.hardwareProfile().memoryMB()); + Assertions.assertEquals(GpuAssignmentTypeEnum.GPUP, + model.hardwareProfile().virtualMachineGPUs().get(0).assignmentType()); + Assertions.assertEquals(4154359310176459322L, + model.hardwareProfile().virtualMachineGPUs().get(0).partitionSizeMB()); + Assertions.assertEquals("hh", model.hardwareProfile().virtualMachineGPUs().get(0).gpuName()); + Assertions.assertEquals("wab", model.storageProfile().dataDisks().get(0).id()); + Assertions.assertEquals("ubmwmbesld", model.networkProfile().networkInterfaces().get(0).id()); + Assertions.assertEquals("fzxmhhvhgureodkw", model.osProfile().computerName()); + Assertions.assertFalse(model.osProfile().linuxConfiguration().provisionVMAgent()); + Assertions.assertTrue(model.osProfile().linuxConfiguration().provisionVMConfigAgent()); + Assertions.assertFalse(model.osProfile().windowsConfiguration().provisionVMAgent()); + Assertions.assertFalse(model.osProfile().windowsConfiguration().provisionVMConfigAgent()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstanceUpdateProperties model = new VirtualMachineInstanceUpdateProperties() + .withHardwareProfile(new HardwareProfileUpdate().withVmSize(VmSizeEnum.STANDARD_DS4_V2) + .withProcessors(11756294) + .withMemoryMB(1564863042825261686L) + .withVirtualMachineGPUs(Arrays.asList( + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(4154359310176459322L) + .withGpuName("hh"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(8381465427069984975L) + .withGpuName("ucerscdntnevfi"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(2197529378012958705L) + .withGpuName("dsslswt"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(1708954452668375735L) + .withGpuName("fzp")))) + .withStorageProfile( + new StorageProfileUpdate().withDataDisks(Arrays.asList(new VirtualHardDiskArmReference().withId("wab"), + new VirtualHardDiskArmReference().withId("tshhszhedp")))) + .withNetworkProfile(new NetworkProfileUpdate() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId("ubmwmbesld"), + new NetworkInterfaceArmReference().withId("wwtppj"), + new NetworkInterfaceArmReference().withId("cxogaokonzm"), + new NetworkInterfaceArmReference().withId("ikvmkqzeqqk")))) + .withOsProfile(new OsProfileUpdate().withComputerName("fzxmhhvhgureodkw") + .withLinuxConfiguration(new OsProfileUpdateLinuxConfiguration().withProvisionVMAgent(false) + .withProvisionVMConfigAgent(true)) + .withWindowsConfiguration(new OsProfileUpdateWindowsConfiguration().withProvisionVMAgent(false) + .withProvisionVMConfigAgent(false))); + model = BinaryData.fromObject(model).toObject(VirtualMachineInstanceUpdateProperties.class); + Assertions.assertEquals(VmSizeEnum.STANDARD_DS4_V2, model.hardwareProfile().vmSize()); + Assertions.assertEquals(11756294, model.hardwareProfile().processors()); + Assertions.assertEquals(1564863042825261686L, model.hardwareProfile().memoryMB()); + Assertions.assertEquals(GpuAssignmentTypeEnum.GPUP, + model.hardwareProfile().virtualMachineGPUs().get(0).assignmentType()); + Assertions.assertEquals(4154359310176459322L, + model.hardwareProfile().virtualMachineGPUs().get(0).partitionSizeMB()); + Assertions.assertEquals("hh", model.hardwareProfile().virtualMachineGPUs().get(0).gpuName()); + Assertions.assertEquals("wab", model.storageProfile().dataDisks().get(0).id()); + Assertions.assertEquals("ubmwmbesld", model.networkProfile().networkInterfaces().get(0).id()); + Assertions.assertEquals("fzxmhhvhgureodkw", model.osProfile().computerName()); + Assertions.assertFalse(model.osProfile().linuxConfiguration().provisionVMAgent()); + Assertions.assertTrue(model.osProfile().linuxConfiguration().provisionVMConfigAgent()); + Assertions.assertFalse(model.osProfile().windowsConfiguration().provisionVMAgent()); + Assertions.assertFalse(model.osProfile().windowsConfiguration().provisionVMConfigAgent()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceUpdateRequestTests.java b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceUpdateRequestTests.java new file mode 100644 index 000000000000..f968a78279e3 --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/src/test/java/com/azure/resourcemanager/azurestackhci/vm/generated/VirtualMachineInstanceUpdateRequestTests.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.azurestackhci.vm.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.azurestackhci.vm.models.GpuAssignmentTypeEnum; +import com.azure.resourcemanager.azurestackhci.vm.models.HardwareProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.Identity; +import com.azure.resourcemanager.azurestackhci.vm.models.IdentityType; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkInterfaceArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.NetworkProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateLinuxConfiguration; +import com.azure.resourcemanager.azurestackhci.vm.models.OsProfileUpdateWindowsConfiguration; +import com.azure.resourcemanager.azurestackhci.vm.models.StorageProfileUpdate; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualHardDiskArmReference; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateProperties; +import com.azure.resourcemanager.azurestackhci.vm.models.VirtualMachineInstanceUpdateRequest; +import com.azure.resourcemanager.azurestackhci.vm.models.VmSizeEnum; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VirtualMachineInstanceUpdateRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualMachineInstanceUpdateRequest model = BinaryData.fromString( + "{\"properties\":{\"hardwareProfile\":{\"vmSize\":\"Standard_NV6\",\"processors\":1133541665,\"memoryMB\":5718085323874880821,\"virtualMachineGPUs\":[{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":6995511201429396399,\"gpuName\":\"ujmkcjhwqy\"},{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":3152947325406928517,\"gpuName\":\"wj\"},{\"assignmentType\":\"GpuP\",\"partitionSizeMB\":8703835635466312899,\"gpuName\":\"ervnaenqpehi\"},{\"assignmentType\":\"GpuDDA\",\"partitionSizeMB\":3847328622576191056,\"gpuName\":\"ifthnz\"}]},\"storageProfile\":{\"dataDisks\":[{\"id\":\"gnayqigynduh\"}]},\"networkProfile\":{\"networkInterfaces\":[{\"id\":\"kthumaqolbgycdui\"},{\"id\":\"tgccymvaolpss\"}]},\"osProfile\":{\"computerName\":\"fmmdnbbg\",\"linuxConfiguration\":{\"provisionVMAgent\":true,\"provisionVMConfigAgent\":true},\"windowsConfiguration\":{\"provisionVMAgent\":true,\"provisionVMConfigAgent\":false}}},\"identity\":{\"principalId\":\"zdxss\",\"tenantId\":\"bzmnvdfznud\",\"type\":\"SystemAssigned\"}}") + .toObject(VirtualMachineInstanceUpdateRequest.class); + Assertions.assertEquals(VmSizeEnum.STANDARD_NV6, model.properties().hardwareProfile().vmSize()); + Assertions.assertEquals(1133541665, model.properties().hardwareProfile().processors()); + Assertions.assertEquals(5718085323874880821L, model.properties().hardwareProfile().memoryMB()); + Assertions.assertEquals(GpuAssignmentTypeEnum.GPUP, + model.properties().hardwareProfile().virtualMachineGPUs().get(0).assignmentType()); + Assertions.assertEquals(6995511201429396399L, + model.properties().hardwareProfile().virtualMachineGPUs().get(0).partitionSizeMB()); + Assertions.assertEquals("ujmkcjhwqy", + model.properties().hardwareProfile().virtualMachineGPUs().get(0).gpuName()); + Assertions.assertEquals("gnayqigynduh", model.properties().storageProfile().dataDisks().get(0).id()); + Assertions.assertEquals("kthumaqolbgycdui", + model.properties().networkProfile().networkInterfaces().get(0).id()); + Assertions.assertEquals("fmmdnbbg", model.properties().osProfile().computerName()); + Assertions.assertTrue(model.properties().osProfile().linuxConfiguration().provisionVMAgent()); + Assertions.assertTrue(model.properties().osProfile().linuxConfiguration().provisionVMConfigAgent()); + Assertions.assertTrue(model.properties().osProfile().windowsConfiguration().provisionVMAgent()); + Assertions.assertFalse(model.properties().osProfile().windowsConfiguration().provisionVMConfigAgent()); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualMachineInstanceUpdateRequest model = new VirtualMachineInstanceUpdateRequest() + .withProperties(new VirtualMachineInstanceUpdateProperties() + .withHardwareProfile(new HardwareProfileUpdate().withVmSize(VmSizeEnum.STANDARD_NV6) + .withProcessors(1133541665) + .withMemoryMB(5718085323874880821L) + .withVirtualMachineGPUs(Arrays.asList( + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(6995511201429396399L) + .withGpuName("ujmkcjhwqy"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(3152947325406928517L) + .withGpuName("wj"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPUP) + .withPartitionSizeMB(8703835635466312899L) + .withGpuName("ervnaenqpehi"), + new VirtualMachineInstancePropertiesHardwareProfileVirtualMachineGPU() + .withAssignmentType(GpuAssignmentTypeEnum.GPU_DDA) + .withPartitionSizeMB(3847328622576191056L) + .withGpuName("ifthnz")))) + .withStorageProfile(new StorageProfileUpdate() + .withDataDisks(Arrays.asList(new VirtualHardDiskArmReference().withId("gnayqigynduh")))) + .withNetworkProfile(new NetworkProfileUpdate() + .withNetworkInterfaces(Arrays.asList(new NetworkInterfaceArmReference().withId("kthumaqolbgycdui"), + new NetworkInterfaceArmReference().withId("tgccymvaolpss")))) + .withOsProfile(new OsProfileUpdate().withComputerName("fmmdnbbg") + .withLinuxConfiguration(new OsProfileUpdateLinuxConfiguration().withProvisionVMAgent(true) + .withProvisionVMConfigAgent(true)) + .withWindowsConfiguration(new OsProfileUpdateWindowsConfiguration().withProvisionVMAgent(true) + .withProvisionVMConfigAgent(false)))) + .withIdentity(new Identity().withType(IdentityType.SYSTEM_ASSIGNED)); + model = BinaryData.fromObject(model).toObject(VirtualMachineInstanceUpdateRequest.class); + Assertions.assertEquals(VmSizeEnum.STANDARD_NV6, model.properties().hardwareProfile().vmSize()); + Assertions.assertEquals(1133541665, model.properties().hardwareProfile().processors()); + Assertions.assertEquals(5718085323874880821L, model.properties().hardwareProfile().memoryMB()); + Assertions.assertEquals(GpuAssignmentTypeEnum.GPUP, + model.properties().hardwareProfile().virtualMachineGPUs().get(0).assignmentType()); + Assertions.assertEquals(6995511201429396399L, + model.properties().hardwareProfile().virtualMachineGPUs().get(0).partitionSizeMB()); + Assertions.assertEquals("ujmkcjhwqy", + model.properties().hardwareProfile().virtualMachineGPUs().get(0).gpuName()); + Assertions.assertEquals("gnayqigynduh", model.properties().storageProfile().dataDisks().get(0).id()); + Assertions.assertEquals("kthumaqolbgycdui", + model.properties().networkProfile().networkInterfaces().get(0).id()); + Assertions.assertEquals("fmmdnbbg", model.properties().osProfile().computerName()); + Assertions.assertTrue(model.properties().osProfile().linuxConfiguration().provisionVMAgent()); + Assertions.assertTrue(model.properties().osProfile().linuxConfiguration().provisionVMConfigAgent()); + Assertions.assertTrue(model.properties().osProfile().windowsConfiguration().provisionVMAgent()); + Assertions.assertFalse(model.properties().osProfile().windowsConfiguration().provisionVMConfigAgent()); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.identity().type()); + } +} diff --git a/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/tsp-location.yaml b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/tsp-location.yaml new file mode 100644 index 000000000000..ae00f9eaf50a --- /dev/null +++ b/sdk/azurestackhci/azure-resourcemanager-azurestackhci-vm/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/azurestackhci/AzureStackHCI.StackHCIVM.Management +commit: 260ed6a52537921f53a18ffaf4020e3b4d510367 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/azurestackhci/ci.yml b/sdk/azurestackhci/ci.yml index cea38df56932..c8c52968cb14 100644 --- a/sdk/azurestackhci/ci.yml +++ b/sdk/azurestackhci/ci.yml @@ -29,6 +29,16 @@ pr: - sdk/azurestackhci/pom.xml - sdk/azurestackhci/azure-resourcemanager-azurestackhci/pom.xml +parameters: + - name: release_azureresourcemanagerazurestackhci + displayName: 'azure-resourcemanager-azurestackhci' + type: boolean + default: false + - name: release_azureresourcemanagerazurestackhcivm + displayName: 'azure-resourcemanager-azurestackhci-vm' + type: boolean + default: false + extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: @@ -37,3 +47,8 @@ extends: - name: azure-resourcemanager-azurestackhci groupId: com.azure.resourcemanager safeName: azureresourcemanagerazurestackhci + releaseInBatch: ${{ parameters.release_azureresourcemanagerazurestackhci }} + - name: azure-resourcemanager-azurestackhci-vm + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerazurestackhcivm + releaseInBatch: ${{ parameters.release_azureresourcemanagerazurestackhcivm }} diff --git a/sdk/azurestackhci/pom.xml b/sdk/azurestackhci/pom.xml index ce6553687904..b283111f2ce2 100644 --- a/sdk/azurestackhci/pom.xml +++ b/sdk/azurestackhci/pom.xml @@ -10,6 +10,7 @@ 1.0.0 - azure-resourcemanager-azurestackhci + azure-resourcemanager-azurestackhci + azure-resourcemanager-azurestackhci-vm